先利用is_tax()来判断是否是自定义分类法的分类,然后获取关键字、描述的内容,然后使用add_action(‘wp_head’,’leaf_key_desc’)输出。叶子读取的关键字和描述是存放在分类图像说明里面的,格式为:分类简介||标题||关键字||描述。所以,叶子使用了explode()函数来读取,分隔符号为“||”。
is_tax(); //只要是自定义分类归档的页面都返回true is_tax( 'shop' ); //自定义分类名为“shop”的归档页面返回ture is_tax( 'theme', 'shop' ); //自定义分类为“theme”而且属于“shop”的分类下的归档页面返回true 更多详细的介绍可以前往官网介绍:http://codex.wordpress.org/Function_Reference/is...
is_page(array(42,’about-me’,’About Me And Joe’)) 当所显示的页面 ID 为42,或post_name为"about-me",或post_title为"About Me And Joe"时,is_page(array(42,’about-me’,’About Me And Joe’))标签返回TRUE。 is_page( array( 42, 54, 6 ) ) 当页面的 ID 为 42、 54 或 6 时,...
is_sticky() WordPress 带有置顶文章的功能,使用这个标签判断是否为置顶文章,需要传递一个参数(通常为文章 id,用法同上)。如果不想传递参数,需要用在主循环(Loop)中,由主循环提供。通常的用法是在主循环输出文章索引列表的时候,使用 is_sticky() 判断当前文章是否为置顶文章,然后在置顶文章的 title 前面输出 “[置...
if((is_category() || is_tag() || is_tax()) && get_query_var('paged') < 2){ return get_term_meta(get_queried_object_id(), 'seo_title', true) ?: $title; } return $title; }); 然后把「SEO描述」和「SEO关键字」输出到分类/标签/自定义分类页的 head 中: ...
elseif ( is_search() && $template = get_search_template() ) : elseif ( is_tax() && $template = get_taxonomy_template() ) : elseif ( is_front_page() && $template = get_front_page_template() ) : elseif ( is_home() && $template = get_home_template() ) : ...
$is_tax: 检查是否是存档的分类页面。 $is_search: 检查是否是查询返回结果的页面。 $is_feed: 检查是否是订阅的页面。 $is_comment_feed: 检查是否是订阅评论的页面。 $is_trackback: 检查是否是引用的页面。 $is_home: 检查是否是主页。 $is_404: 检查是否是404页面。
Start by entering a name your new code snippet, which can be anything to help you remember what the code is for. After that, simply paste the following code into the ‘Code Preview’ area: //hook into the init action and call create_book_taxonomies when it fires ...
WordPress, Git-ified. This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit pull requests to https://github.com/WordPress/wordpress-develop and patches to https://core.trac.wordpress.org/ instea
WordPress, Git-ified. This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit pull requests to https://github.com/WordPress/wordpress-develop and patches to https://core.trac.wordpress.org/ instea