条件标签是布尔数据类型,用于在模板文件中根据当前页面匹配的条件来调整内容显示。它们通常与 PHP if/else 条件语句结合使用,并与 WordPress 模板层次结构密切相关。
Conditional Tags are a boolean data type that can be used in your Template Files to alter the display of content depending on the conditions that the current page matches. They tell WordPress what code to display under specific conditions. Conditional Tags usually work with PHP if /else Conditional Statements and have close relation with WOrdPress Template Hierarchy. .
Warning: You can only use conditional query tags after the WP_Query is set up or with action hook.
All of the Conditional Tags test to see whether a certain condition is met, and then returns either TRUE or FALSE. The conditions under which various tags output TRUE is listed below. Those tags which can accept parameters are so noted.