WordPress页面、文章、分类等的条件判断的标签集合

WordPress页面、文章、分类等的条件判断的标签集合

  1. is_home()   
  2. 判断是否为首页.   
  3.   
  4. The Front Page 首页头版消息设置   
  5. is_front_page()   
  6. 判断是否为首页头版消息. (无论是日志或是页面).当系统显示博客主页且管理面板的设置>阅读菜单下 “主页显示为”选项设为最近发表的文章”,或者’设置>阅读菜单下”主页显示为”选项设为且”主页”是当前被显示的页面时,is_front_page() 标签返回TRUE。   
  7.   
  8.   
  9. The Administration Panels 管理控制面板   
  10. is_admin()   
  11. 判断是否为后台管理控制面板.   
  12.   
  13. A Single Post Page 单篇日志   
  14. is_single()   
  15. 判断是否为任何单篇日志.   
  16. is_single(’17′)   
  17. 判断是否为ID17的单篇日志.   
  18. is_single(‘Irish Stew’)   
  19. 判断是否标题为”Irish Stew”的单篇日志.   
  20. is_single(‘beef-stew’)   
  21. 判断是否别名为 “beef-stew”的单篇日志.   
  22. is_single(array(17,’beef-stew’,’Irish Stew’))   
  23. 判断是否为ID17, 或别名为”beef-stew”, 或标题为 “Irish Stew”的单篇日志.   
  24. is_single(array(17, 19, 1, 11))   
  25. 判断是否为ID 17, 19, 1, 11 的文章.   
  26. is_single(array(‘beef-stew’, ‘pea-soup’, ‘chili’))   
  27. 判断是否别名为 “beef-stew”, 别名为 “pea-soup” 或 别名为 “chili” 的单篇日志.   
  28. is_single(array(‘Beef Stew’, ‘Pea Soup’, ‘Chili’))   
  29. 判断是否标题为 “Beef Stew”,标题为 “Pea Soup” 或标题为 “Chili” 的单篇日志.   
  30.   
  31. A Sticky Post 置顶文章   
  32. is_sticky()   
  33. 判断是否为置顶文章.   
  34. is_sticky(’17′)   
  35. 判断是否为ID17的置顶文章.   
  36.   
  37. A Post Type   
  38. is_post_type($post_type)   
  39. Returns true if the value in $post_type is a valid registered post type. This should not be confused with testing to see if a given post is of a particular post type. Note: this conditional tag became available with Version 3.0.   
  40. is_post_type(‘book’)   
  41. Returns true if book is a registered post type.   
  42.   
  43. A Post Type is Hierarchical   
  44. is_post_type_hierarchical($post_type)   
  45. Returns true if this $post_type has been set with hierarchical support when registered. Note: This ability was added at Version 3.0.   
  46. is_post_type_hierarchical(‘book’)   
  47. Returns true if the book post type was registered as having support for hierarchical.   
  48.   
  49. A Comments Popup 评论的弹出窗口   
  50. is_comments_popup()   
  51. 判断是否为评论的弹出窗口.   
  52.   
  53. Any Page Containing Posts 评论   
  54. comments_open()   
  55. 判断当前文章是否允许评论.   
  56. pings_open()   
  57. 判断当前文章是否允许广播(pingback).   
  58.   
  59. A PAGE Page 页面   
  60. is_page()   
  61. 判断是否任何页面.   
  62. is_page(’42′)   
  63. 判断是否ID 42的页面.   
  64. is_page(‘About Me And Joe’)   
  65. 判断是否标题为”About Me And Joe” 的页面.   
  66. is_page(‘about-me’)   
  67. 判断是否别名为 “about-me” 的页面.   
  68. is_page(array(42,’about-me’,’About Me And Joe’))   
  69. 判断是否为 ID 42, 或别名 “about-me”, 或标题 “About Me And Joe” 的页面.   
  70.   
  71. A Category Page 分类归档   
  72. is_category()   
  73. 判断是否为任何分类页.   
  74. is_category(’9′)   
  75. 判断是否为ID9的分类页.   
  76. is_category(‘Stinky Cheeses’)   
  77. 判断是否名称为 “Stinky Cheeses”的分类归档页.   
  78. is_category(‘blue-cheese’)   
  79. 判断别名是否为 “blue-cheese”的分类归档页.   
  80. is_category(array(9,’blue-cheese’,’Stinky Cheeses’))   
  81. 判断是否ID为 9, 或者别名为 “blue-cheese”, 或者名称为 “Stinky Cheeses”的分类归档页.   
  82. in_category(’5′)   
  83. 判断当前文章的分类ID是否为5   
  84. in_category( array( 1,2,3 ) )   
  85. 判断当前文章的分类ID是否为 1, 2, 或 3.   
  86. !in_category( array( 4,5,6 ) )   
  87. 判断当前文章的分类ID是否不是 4, 5, 或 6 .   
  88.   
  89. A Tag Page 标签归档   
  90. is_tag()   
  91. 判断是否为标签页   
  92. is_tag(‘mild’)   
  93. 判断是否为别名 ‘mild’ 的标签归档页.   
  94. is_tag(array(‘sharp’,’mild’,’extreme’))   
  95. 判断别名是否为 “sharp”, “mild”, 或 “extreme” 的标签归档页.   
  96. has_tag()   
  97. 判断当前文章是否有标签.   
  98. has_tag(‘mild’)   
  99. 判断当前文章是否有标签 ‘mild’.   
  100. has_tag(array(‘sharp’,’mild’,’extreme’))   
  101. 判断当前文章是否包含一个数组中的标签.   
  102.   
  103. A Taxonomy Page 分类法页面   
  104. is_tax()   
  105. 显示任何分类法归档页面时,is_tax()会返回TRUE。.   
  106. is_tax(‘mild’)   
  107. 示分类法归档页面别名为“mild”时, is_tax(‘mild’)返回TRUE.   
  108. is_tax(array(‘sharp’,’mild’,’extreme’))   
  109. 当前分类法归档别名为数组中的任一个”sharp”, “mild”, 或 “extreme”时,is_tax(array(‘sharp’,’mild’,’extreme’)) 返回TRUE.   
  110.   
  111. A Registered Taxonomy 注册过的分类法   
  112. is_taxonomy()   
  113. 当某一种分类法通过register_taxonomy()注册, is_taxonomy()  返回TRUE.   
  114.   
  115. An Author Page 作者归档   
  116. is_author()   
  117. 判断是否为作者归档页.   
  118. is_author(’4′)   
  119. 判断是否为ID4的作者归档页.   
  120. is_author(‘Vivian’)   
  121. 判断是否为昵称 “Vivian”的作者归档页.   
  122. is_author(‘john-jones’)   
  123. 判断是否为昵称 “john-jones” 的作者归档页.   
  124. is_author(array(4,’john-jones’,’Vivian’))   
  125. 判断是否为 ID 4, 或者昵称 “john-jones”, 或昵称 “Vivian” 的作者标签页.   
  126.   
  127. Date Page 日期归档页   
  128. is_date()   
  129. 判断是否为日期归档页.   
  130. is_year()   
  131. 判断是否为按年归档页.   
  132. is_month()   
  133. When a monthly archive is being displayed.   
  134. is_day()   
  135. 判断是否为按天归档页.   
  136. is_time()   
  137. 判断是否按小时, “分钟”, “秒”归档页.   
  138.   
  139. Any Archive Page 归档页   
  140. is_archive()   
  141. 是否归档页.   
  142.   
  143. A Search Result Page 搜索结果页   
  144. is_search()   
  145. 是否搜索页.   
  146.   
  147. A 404 Not Found Page 未找到页面   
  148. is_404()   
  149. 是否404页面.   
  150.   
  151. A Paged Page 分页   
  152. is_paged()   
  153. 判断是否有分页. 需要将 <!–nextpage–> 快速标签插入到文章中才能将文章分成多页.   
  154.   
  155. An Attachment 附件   
  156. is_attachment()   
  157. 判断是否为附件文档. 附件是通过编辑器上传工具上传的图片或其他文件. 附件能显示在相应的页面或模版中.   
  158.   
  159. A Single Page, Single Post or Attachment 独立页面、单篇日志或附件   
  160. is_singular()   
  161. 当is_single(), is_page() 或is_attachment()返回TRUE时,is_singular() 也返回TRUE。.   
  162. is_singular(‘book’)   
  163. True when viewing a post of the post type book. Introduced with Version 3.0.   
  164. is_singular(array( ‘newspaper’, ‘book’ ))   
  165. True when viewing a post of the post type newspaper or book. Introduced with Version 3.0.   
  166.   
  167. A Syndication   
  168. is_feed()   
  169. 网站需要使用RSS订阅时,is_feed()返回TRUE。一般情况下会用到is_feed()标签的是WordPress系统和插件开发人员,普通 WordPress用户很少用到is_feed()标签.   
  170.   
  171. A Trackback 引用通知   
  172. is_trackback()   
  173. 网站需要将WordPress钩子勾入Trackback。一般情况下会用到这个标签的是WordPress系统和插件开发人员,普通WordPress 用户很少用到is_feed()标签.   
  174.   
  175. A Preview 草稿预览   
  176. is_preview()   
  177. 判断文章是否显示在草稿预览模式.   
  178.   
  179. Has An Excerpt 摘要   
  180. has_excerpt()   
  181. 判断当前文章是否有摘要.   
  182. has_excerpt(’42′)   
  183. 判断ID42的文章是否有摘要.   
  184.   
  185. Inside The Loop 循环   
  186. in_the_loop()   
  187. 判断目前是否在WordPress主循环中. 该标签适用于插件开发人员, 若目前在WordPress主循环中, 该标签返回TRUE.   
  188.   
  189. Is Sidebar Active 边栏   
  190. is_active_sidebar()   
  191. 检查现有侧边栏是否被激活(是否启用).若侧边栏被启用,is_active_sidebar() 返回TRUE,否则返回FALSE.   
  192.   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值