• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP has_category函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: meta_elements

 /**
  * Figure out the post meta that we want to use and inject them to our content.
  */
 public static function meta_elements($post_id = '')
 {
     if ('' == $post_id) {
         global $post;
         $post_id = $post->ID;
     }
     $post = get_post($post_id);
     // Get the options from the db
     $metas = get_theme_mod('maera_entry_meta_config', 'post-format, date, author, comments');
     $date_format = get_theme_mod('date_meta_format', 1);
     $categories_list = has_category('', $post_id) ? get_the_category_list(__(', ', 'maera_bs'), '', $post_id) : false;
     $tag_list = has_tag('', $post_id) ? get_the_tag_list('', __(', ', 'maera_bs')) : false;
     // No need to proceed if the option is empty
     if (empty($metas)) {
         return;
     }
     $content = '';
     // convert options from CSV to array
     $metas_array = explode(',', $metas);
     // clean up the array a bit... make sure there are no spaces that may mess things up
     $metas_array = array_map('trim', $metas_array);
     return $metas_array;
 }
开发者ID:sevir,项目名称:maera-bootstrap,代码行数:26,代码来源:class-maera-bs-meta.php


示例17: restful_post_meta_below

/**
 * Post meta for below the post.
 */
function restful_post_meta_below()
{
    if (!has_category() && !has_tag()) {
        return false;
    }
    ?>

  <div class="entry__meta entry__meta--inline entry__meta--below">
    <?php 
    if (has_category()) {
        ?>
      <div class="entry__meta-item">
        <i class="fa fa-folder"></i>
        <?php 
        the_category(', ');
        ?>
      </div>
    <?php 
    }
    ?>

    <?php 
    if (has_tag()) {
        ?>
      <div class="entry__meta-item">
        <i class="fa fa-tags"></i>
        <?php 
        the_tags('');
        ?>
      </div>
    <?php 
    }
    ?>
  </div>

<?php 
}
开发者ID:themebright,项目名称:Restful,代码行数:40,代码来源:template-tags.php


示例18: the_author

						<div class="post_info post_info_2">
                        <?php 
    if (of_get_option('dissauth_checkbox') == "0") {
        ?>
							<span class="post_author">Posted by: <a class="post_author"><?php 
        the_author();
        ?>
</a></span><?php 
    }
    ?>
							<span class="post_info_delimiter"></span>
                            <?php 
    if (of_get_option('disscats_checkbox') == "0") {
        ?>
                           <?php 
        if (has_category()) {
            ?>
							<span class="post_categories">
								<span class="cats_label">Categories:</span>
								<a class="cat_link"><?php 
            the_category(' ');
            ?>
</a>
							
							</span>
							
							<?php 
        }
    }
    ?>
                          <div class="post_comments"><a><span class="comments_number"> <?php 
开发者ID:sota1236,项目名称:blog.koe11.net,代码行数:31,代码来源:archive.php


示例19: in_category

/**
 * Check if the current post is within any of the given categories.
 *
 * The given categories are checked against the post's categories' term_ids, names and slugs.
 * Categories given as integers will only be checked against the post's categories' term_ids.
 *
 * Prior to v2.5 of WordPress, category names were not supported.
 * Prior to v2.7, category slugs were not supported.
 * Prior to v2.7, only one category could be compared: in_category( $single_category ).
 * Prior to v2.7, this function could only be used in the WordPress Loop.
 * As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
 *
 * @since 1.2.0
 *
 * @param int|string|array $category Category ID, name or slug, or array of said.
 * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
 * @return bool True if the current post is in any of the given categories.
 */
function in_category($category, $post = null)
{
    if (empty($category)) {
        return false;
    }
    return has_category($category, $post);
}
开发者ID:CompositeUK,项目名称:clone.WordPress-Core,代码行数:25,代码来源:category-template.php


示例20: the_excerpt

}
?>
          <div class="post-entry-content">
<?php 
if ($brickyard_options_db['brickyard_content_archives'] != 'Content') {
    the_excerpt();
} else {
    global $more;
    $more = 0;
    the_content();
}
?>
          </div>
        </div>
<?php 
if ($brickyard_options_db['brickyard_display_meta_post'] != 'Hide' && has_category()) {
    ?>
        <div class="post-info">
          <p class="post-category"><span class="post-info-category"><?php 
    the_category(', ');
    ?>
</span></p>
          <p class="post-tags"><?php 
    the_tags('<span class="post-info-tags">', ', ', '</span>');
    ?>
</p>
        </div>
<?php 
}
?>
      </article>
开发者ID:jrbranaa,项目名称:pitchperspectives,代码行数:31,代码来源:content-archives.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP has_category_access函数代码示例发布时间:2022-05-15
下一篇:
PHP has_capability_in_accessdata函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap