当前位置: 首页>>代码示例>>PHP>>正文


PHP has_category函数代码示例

本文整理汇总了PHP中has_category函数的典型用法代码示例。如果您正苦于以下问题:PHP has_category函数的具体用法?PHP has_category怎么用?PHP has_category使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了has_category函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ultra_entry_footer

 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function ultra_entry_footer()
 {
     if (is_single() && has_category() && siteorigin_setting('blog_post_cats')) {
         echo '<span class="cat-links">' . get_the_category_list(__(', ', 'ultra')) . '</span>';
     }
     if (is_single() && has_tag() && siteorigin_setting('blog_post_tags')) {
         echo '<span class="tags-links">' . get_the_tag_list('', __(', ', 'ultra')) . '</span>';
     }
     if (siteorigin_setting('blog_edit_link')) {
         edit_post_link(__('Edit', 'ultra'), '<span class="edit-link">', '</span>');
     }
 }
开发者ID:craighays,项目名称:wpcraighays,代码行数:15,代码来源:template-tags.php

示例2: get_child_category

 static function get_child_category($post_id)
 {
     $sub_category_names = self::subCategoryNames();
     foreach ($sub_category_names as $sub_category_name) {
         if (has_category($sub_category_name, get_post($post_id))) {
             return $sub_category_name;
         }
     }
 }
开发者ID:gato-gordo,项目名称:association-print-scholars,代码行数:9,代码来源:Scholarship.php

示例3: get_parent_category

 static function get_parent_category($post_id)
 {
     foreach (self::$parent_categories as $category) {
         if (has_category($category, get_post($post_id))) {
             return $category;
         }
     }
     return NULL;
 }
开发者ID:gato-gordo,项目名称:association-print-scholars,代码行数:9,代码来源:MemberManageableResource.php

示例4: get_sub_category

 function get_sub_category($id)
 {
     $sub_categories = get_categories(array('child_of' => $id, 'hierarchical' => false, 'orderby' => 'count'));
     foreach ($sub_categories as $sub_category) {
         if (has_category($sub_category->term_id)) {
             $category = $sub_category;
         }
     }
     return isset($category) ? $category : null;
 }
开发者ID:kishandchips,项目名称:thebankcorporate,代码行数:10,代码来源:functions.php

示例5: mh_newsdesk_lite_post_meta

 function mh_newsdesk_lite_post_meta()
 {
     echo '<p class="entry-meta">' . "\n";
     if (has_category() && !is_single()) {
         echo '<span class="entry-meta-cats">' . get_the_category_list(', ', '') . '</span>' . "\n";
     }
     if (is_single()) {
         echo '<span class="entry-meta-author vcard author">' . sprintf(_x('Posted By: %s', 'post author', 'mh-newsdesk-lite'), '<a class="fn" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a>') . '</span>' . "\n";
     }
     echo '<span class="entry-meta-date updated">' . get_the_date() . '</span>' . "\n";
     echo '</p>' . "\n";
 }
开发者ID:jimdough,项目名称:Roadmaster,代码行数:12,代码来源:mh-custom-functions.php

示例6: prefix_pronamic_google_maps_marker_options_icon

/**
 * Filter snippet
 */
function prefix_pronamic_google_maps_marker_options_icon($url)
{
    if (has_category('airport')) {
        return 'http://google-maps-icons.googlecode.com/files/airport.png';
    } elseif (has_category('bar')) {
        return 'http://google-maps-icons.googlecode.com/files/bar.png';
    } elseif (has_category('beach')) {
        return 'http://google-maps-icons.googlecode.com/files/beach.png';
    } else {
        return $url;
    }
}
开发者ID:Warpsmith,项目名称:wp-pronamic-google-maps,代码行数:15,代码来源:mashup-categories-fixed-marker-icon.php

示例7: print_category

 protected function print_category($cat, $sep = '')
 {
     $term_meta = get_option('ipt_kb_category_meta_' . $cat->term_id, array());
     echo '<a href="' . esc_url(get_category_link($cat->term_id)) . '" class="list-group-item' . (is_category($cat->term_id) || is_single() && has_category($cat->term_id) ? ' active' : '') . '">';
     echo '<span class="badge">' . ipt_kb_total_cat_post_count($cat->term_id) . '</span>';
     echo $sep;
     $icon_class = 'ipt-books';
     if (isset($term_meta['icon_class']) && trim($term_meta['icon_class']) != '') {
         $icon_class = $term_meta['icon_class'];
     }
     echo '<span class="glyphicon ' . $icon_class . '"></span>&nbsp;';
     echo $cat->name . '</a>';
 }
开发者ID:andychoi,项目名称:k-knowledgebase-theme-wp,代码行数:13,代码来源:class-ipt-kb-knowledgebase-widget.php

示例8: aps_scholarship_page_numbers

function aps_scholarship_page_numbers()
{
    if (has_category('scholarship-article')) {
        $page_numbers = get_field('scholarship_article_pages');
    } else {
        if (has_category('scholarship-book-chapter')) {
            $page_numbers = get_field('scholarship_book_chapter_page_numbers');
        } else {
            if (has_category('scholarship-review')) {
                $page_numbers = get_field('scholarship_review_pages');
            }
        }
    }
    if ($page_numbers) {
        echo ": {$page_numbers}";
    }
}
开发者ID:gato-gordo,项目名称:association-print-scholars,代码行数:17,代码来源:scholarship_functions.php

示例9: add_elp

function add_elp($content)
{
    global $post;
    if (has_category('European Language Portfolio') && function_exists('elaplugin_activate')) {
        $elp = new EuropeanLanguagePortfolio($post);
        $elp->build_scoreset();
        //show graph on single pages only
        if (is_single()) {
            return $content . $elp->elp_title() . $elp->render_graph_divs() . $elp->elp_content();
        } else {
            return $content . $elp->elp_title() . $elp->elp_content();
        }
        //otherwise return the normal content
    } else {
        return $content;
    }
}
开发者ID:bacalj,项目名称:wp-european-language-assessment,代码行数:17,代码来源:elaplugin.php

示例10: widget

 function widget($args, $instance)
 {
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => ''));
     $title = $instance['title'];
     if (is_singular('post') && has_category()) {
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title;
             echo apply_filters('widget_title', esc_attr($title), $instance, $this->id_base);
             echo $after_title;
         }
         echo '<div><ul><li>';
         the_category('</li><li>');
         echo '</li></ul></div>';
         echo $after_widget;
     }
 }
开发者ID:roundtopdog,项目名称:wordpress,代码行数:19,代码来源:mythemes.post_categories.class.php

示例11: fitclub_entry_meta

    /**
     * Display meta description of post.
     */
    function fitclub_entry_meta()
    {
        if ('post' == get_post_type() && get_theme_mod('fitclub_postmeta', '') == '') {
            echo '<div class="entry-meta">';
            ?>
   		<?php 
            if (get_theme_mod('fitclub_postmeta_author', '') == '') {
                ?>
		<span class="byline author vcard"><a href="<?php 
                echo esc_url(get_author_posts_url(get_the_author_meta('ID')));
                ?>
" title="<?php 
                echo get_the_author();
                ?>
"><i class="fa fa-user"></i><?php 
                echo esc_html(get_the_author());
                ?>
</a></span>
		<?php 
            }
            if (!post_password_required() && comments_open() && get_theme_mod('fitclub_postmeta_comment', '') == '') {
                ?>
		<span class="comments-link"><i class="fa fa-comments-o"></i><?php 
                comments_popup_link(esc_html__('0 Comment', 'fitclub'), esc_html__('1 Comment', 'fitclub'), esc_html__(' % Comments', 'fitclub'));
                ?>
</span>
		<?php 
            }
            if (has_category() && get_theme_mod('fitclub_postmeta_category', '') == '') {
                ?>
		<span class="cat-links"><i class="fa fa-folder-open"></i><?php 
                the_category(', ');
                ?>
</span>
		<?php 
            }
            $tags_list = get_the_tag_list('<span class="tag-links">', ', ', '</span>');
            if ($tags_list && get_theme_mod('fitclub_postmeta_tags', '') == '') {
                echo $tags_list;
            }
            echo '</div>';
        }
    }
开发者ID:themegrill,项目名称:fitclub,代码行数:46,代码来源:fitclub.php

示例12: mantra_breadcrumbs

/**
 * Creates breadcrumns with page sublevels and category sublevels.
 */
function mantra_breadcrumbs()
{
    $mantra_options = mantra_get_theme_options();
    foreach ($mantra_options as $key => $value) {
        ${"{$key}"} = $value;
    }
    global $post;
    echo '<div class="breadcrumbs">';
    if (is_page() && !is_front_page() || is_single() || is_category() || is_archive()) {
        echo '<a href="' . get_bloginfo('url') . '">' . get_bloginfo('name') . ' &raquo; </a>';
        if (is_page()) {
            $ancestors = get_post_ancestors($post);
            if ($ancestors) {
                $ancestors = array_reverse($ancestors);
                foreach ($ancestors as $crumb) {
                    echo '<a href="' . get_permalink($crumb) . '">' . get_the_title($crumb) . ' &raquo; </a>';
                }
            }
        }
        if (is_single()) {
            if (has_category()) {
                $category = get_the_category();
                echo '<a href="' . get_category_link($category[0]->cat_ID) . '">' . $category[0]->cat_name . ' &raquo; </a>';
            }
        }
        if (is_category()) {
            $category = get_the_category();
            echo '' . $category[0]->cat_name . '';
        }
        // Current page
        if (is_page() || is_single()) {
            echo '' . get_the_title() . '';
        }
        echo '';
    } elseif (is_home() && $mantra_frontpage != "Enable") {
        // Front page
        echo '';
        echo '<a href="' . get_bloginfo('url') . '">' . get_bloginfo('name') . '</a> ' . "&raquo; ";
        _e('Home Page', 'mantra');
        echo '';
    }
    echo '</div>';
}
开发者ID:rzb,项目名称:boletos2,代码行数:46,代码来源:theme-functions.php

示例13: widget

 function widget($args, $instance)
 {
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $title = !empty($instance['title']) ? $instance['title'] : '';
     if (is_singular('post') && has_category()) {
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title;
             echo $title;
             echo $after_title;
         }
         echo '<div>';
         echo '<ul>';
         echo '<li>';
         the_category('</li><li>');
         echo '</li>';
         echo '</ul>';
         echo '</div>';
         echo $after_widget;
     }
 }
开发者ID:mathieu-aubin,项目名称:verbo-linuq,代码行数:22,代码来源:my_wdg_post_categories.php

示例14: categories

function categories()
{
    /**
     *
     * This checks if the current post has any attached categories
     * not including those defined in $not_these array and if passing,
     * loops thru and echo's the attached categories
     * @see https://developer.wordpress.org/reference/functions/get_the_category
     * @see https://codex.wordpress.org/Function_Reference/get_category_link
     *
     */
    $not_these = ['post', 'uncategorized'];
    if (!has_category($not_these)) {
        $categories = get_the_category();
        echo '<ul class="list-reset slash">';
        foreach ($categories as $category) {
            $link = get_category_link($category);
            echo '<li class="inline-block mr1"><a href="' . $link . '">' . $category->name . '</a></li>';
        }
        echo '</ul>';
    }
}
开发者ID:jchck,项目名称:jchck_,代码行数:22,代码来源:category.php

示例15: widget

 function widget($args, $instance)
 {
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $title = !empty($instance['title']) ? esc_attr($instance['title']) : '';
     if (is_singular('post') && has_category()) {
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title;
             echo apply_filters('widget_title', $title, $instance, $this->id_base);
             echo $after_title;
         }
         echo '<div>';
         echo '<ul>';
         echo '<li>';
         the_category('</li><li>');
         echo '</li>';
         echo '</ul>';
         echo '</div>';
         echo $after_widget;
     }
 }
开发者ID:jeremygeltman,项目名称:ThinkThinly,代码行数:22,代码来源:my_wdg_post_categories.php


注:本文中的has_category函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。