绿站
绿色文摘
今天是:

交流 | 搜索 | +发贴

WordPress条件标签大全
nydalu 2024年5月22日 489次

条件标签是一种布尔数据类型,可以在你的模板文件中使用,以改变内容的显示,取决于当前页面匹配的条件。它们告诉WordPress在特定条件下显示什么代码。条件标签通常与PHP的if/else条件语句一起工作,并与WordPress的模板层次结构有密切关系。

警告:你只能在WP_Query设置后或与动作钩子一起使用条件查询标签。

条件标签的完整列表
is_front_page()
is_home()
is_admin()
is_network_admin()
is_admin_bar_showing()
is_single()
is_sticky()
is_post_type_hierarchical( $post_type )
is_post_type_archive()
is_comments_popup()
comments_open()
pings_open()
is_page()
is_page_template()
is_category( $category )
is_tag()
is_tax()
has_term()
term_exists( $term, $taxonomy, $parent )
is_taxonomy_hierarchical( $taxonomy )
taxonomy_exists( $taxonomy )
is_author()
is_date()
is_year()
is_month()
is_day()
is_time()
is_new_day()
is_archive()
is_search()
is_404()
is_paged()
is_attachment()
wp_attachment_is_image( $post_id )
is_local_attachment( $url )
is_singular()
post_type_exists( $post_type )
is_main_query()
is_feed()
is_trackback()
is_preview()
in_the_loop()
is_dynamic_sidebar()
is_active_sidebar()
is_active_widget( $widget_callback, $widget_id )
is_blog_installed()
is_rtl()
is_multisite()
is_main_site()
is_super_admin()
is_user_logged_in()
email_exists( $email )
username_exists( $username )
is_plugin_active( $path )
is_plugin_inactive( $path )
is_plugin_active_for_network( $path )
is_plugin_page()
is_child_theme()
current_theme_supports()
has_post_thumbnail( $post_id )
wp_script_is( $handle, $list )

条件 …
所有的条件标签都会测试是否满足某个条件,然后返回 TRUE 或 FALSE。下面列出了各种标签输出TRUE的条件。那些可以接受参数的标签都有注明。

主页
is_home()

首页
is_front_page()

博客页
is_front_page()
is_home()

文章单页
is_single()

页面
is_page()
is_page_template()

有文章缩略图
has_post_thumbnail( $post_id )

文章单页、单页面、附件、其他任意自定义文章类型
is_singular()

类别页面
is_category( $category )

标签页面
is_tag()
has_tag()

自定义分类页面(以及相关)
is_tax()
has_term()
term_exists( $term, $taxonomy, $parent )
is_taxonomy_hierarchical( $taxonomy )
taxonomy_exists( $taxonomy )

作者页面
is_author()

日期页面
is_date()
is_year()
is_month()
is_day()
is_time()
is_new_day()

任意归档页
is_archive()

搜索结果页
is_search()

404页面
is_404()

侧边栏
is_dynamic_sidebar()

侧边栏是否激活
is_active_sidebar()

小工具是否激活
is_active_widget( $widget_callback, $widget_id )

用户是否登录
is_user_logged_in()

电子邮件存在
email_exists( $email )

用户名存在
username_exists( $username )

分页页面
is_paged()

从右到左阅读
is_rtl()

附件
is_attachment()

附件是图片
wp_attachment_is_image( $post_id )

本地附件
is_local_attachment( $url )

文章类型存在
post_type_exists( $post_type )

是否主查询
is_main_query()

新的一天
is_new_day()

聚合
is_feed()

Trackback
is_trackback()

预览
is_preview()

有摘录
has_excerpt()

有指定导航菜单
has_nav_menu()

博客是否已安装
is_blog_installed()

网络的一部分 (多站点)
is_multisite()
is_main_site()
is_super_admin()

已启用插件
is_plugin_active( $path )
is_plugin_inactive( $path )
is_plugin_active_for_network( $path )
is_plugin_page()

子主题
is_child_theme()

主题支持的功能
current_theme_supports()

在定制器中预览
is_customize_preview()


  • pqf64cd8e32f5ac7553c150bd05d6f2252bb73f68dpq 24-11-18 09:04  

    pq118a9989815489c24b81b160782015890ed2085epq


  • droversointeru 24-12-28 21:21  

    Perfectly written content, thanks for entropy.

    https://www.droversointeru.com


  • droversointeru 25-04-09 23:58  

    Superb site you have here but I was curious about if you knew of any forums that cover the same topics talked about in this article? I’d really like to be a part of community where I can get feed-back from other knowledgeable people that share the same interest. If you have any recommendations, please let me know. Bless you!

    https://www.droversointeru.com


  • Krystina Gacia 25-04-14 19:44  

    When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment. Is there any way you can remove people from that service? Thanks a lot!

    https://www.droversointeru.com


  • 🗒 + 1.783692 BTC.GET - https://graph.org/Ticket--58146-05-02?hs=7b6491047178b5a42b9a8a1833ff72aa& 🗒 25-05-04 11:59  

    uu1km9


  • ⚖ + 1.632341 BTC.NEXT - https://graph.org/Ticket--58146-05-02?hs=7b6491047178b5a42b9a8a1833ff72aa& ⚖ 25-05-12 10:31  

    3o6dfr


  • 📉 + 1.839879 BTC.GET - https://yandex.com/poll/T1TnDbUc4R9aLX7Nzhj1Cy?hs=7b6491047178b5a42b9a8a1833ff72aa& 📉 25-05-16 06:42  

    rsx2at


  • 🔉 Email: + 1.864016 BTC. Confirm => https://yandex.com/poll/enter/TNcY7JqvFXjm5m5YZrG7sv?hs=7b6491047178b5a42b9a8a1833ff72aa& 🔉 25-06-14 01:33  

    b7el66


  • 📝 Message; + 1.779467 BTC. Confirm >> https://yandex.com/poll/enter/4Joc2mvUbapjsUMcMcKM3z?hs=7b6491047178b5a42b9a8a1833ff72aa& 📝 25-06-19 13:40  

    l31smj


  • 📒 + 1.848905 BTC.GET - https://graph.org/Payout-from-Blockchaincom-06-26?hs=7b6491047178b5a42b9a8a1833ff72aa& 📒 25-07-15 06:31  

    vbvu07


  • 📖 ⚡ Fast Transaction - 0.35 Bitcoin received. Confirm now => https://graph.org/GET-FREE-BITCOIN-07-23?hs=7b6491047178b5a42b9a8a1833ff72aa& 📖 25-08-28 14:53  

    zvh3pt


  • 🔊 WALLET UPDATE - Suspicious transfer of 2.0 Bitcoin. Stop? >> https://graph.org/COLLECT-BTC-07-23?hs=7b6491047178b5a42b9a8a1833ff72aa& 🔊 25-09-04 18:20  

    itbu7f


  • 📉 Network; Transfer 1.8 BTC on hold. Fix now >> https://graph.org/Get-your-BTC-09-04?hs=7b6491047178b5a42b9a8a1833ff72aa& 📉 25-09-24 15:15  

    5n8gc8


  • ⛏ 🎁 Crypto Reward - 1.0 BTC added. Collect now > https://graph.org/Get-your-BTC-09-04?hs=7b6491047178b5a42b9a8a1833ff72aa& ⛏ 25-10-08 17:35  

    ey3a36


  • 🔗 Security Notice; 0.4 Bitcoin transfer attempt. Deny? => https://graph.org/Binance-10-06-3?hs=7b6491047178b5a42b9a8a1833ff72aa& 🔗 25-10-30 12:07  

    wvyx2v


  • * * * $3,222 deposit available! Confirm your transaction here: https://botlabs.agency/index.php?vldu3p * * * hs=7b6491047178b5a42b9a8a1833ff72aa* ххх* 25-11-15 00:23  

    kzf67k


  • * * * $3,222 deposit available * * * hs=7b6491047178b5a42b9a8a1833ff72aa* ххх* 25-11-15 00:23  

    kzf67k


  • game bài 66b 25-11-27 13:19  

    xn88 link Hệ thống livestream trực tiếp mang lại cảm giác như bạn đang ngồi tại sòng bạc thật, với sự tương tác trực tiếp và công bằng tuyệt đối. Các bàn chơi được thiết kế tinh tế, giao diện thân thiện và dễ sử dụng, giúp bạn dễ dàng tham gia và tận hưởng.


  • game bài 66b 25-11-30 15:35  

    xn88 gaming Dàn Dealer chuyên nghiệp đến từ Châu Âu và Châu Á chắc chắn sẽ mang đến cho bạn những giây phút thăng hoa giải trí tuyệt vời. 200+ Studio được phát sóng trực tiếp mỗi ngày cho bạn thoải mái tham gia và nhận thưởng bonus với hoa hồng hấp dẫn khi giành chiến thắng.


  • tải 888slot 25-12-12 12:49  

    Trong bài viết này, chúng ta sẽ khám phá chi tiết, từ các sản phẩm cá cược, chương trình khuyến mãi, đến lý do tại sao trở thành lựa chọn hàng đầu của người chơi tại Việt Nam. Chúng ta cũng sẽ tìm hiểu cách tham gia, mẹo chơi hiệu quả và các tính năng nổi bật khiến 188v battery nổi bật trên thị trường cá cược trực tuyến.



  • 关于 ·登录·管理
    加载3.642 查询 16