Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何添加条件语句来检查Wordpress中的Post类型分类法?_Php_Wordpress_If Statement_Conditional_Custom Taxonomy - Fatal编程技术网

Php 如何添加条件语句来检查Wordpress中的Post类型分类法?

Php 如何添加条件语句来检查Wordpress中的Post类型分类法?,php,wordpress,if-statement,conditional,custom-taxonomy,Php,Wordpress,If Statement,Conditional,Custom Taxonomy,我目前有以下条件陈述- <?php if ( is_front_page() || is_page_template( 'page-fullwidth.php' ) || is_product() ) { ?> <?php } elseif ( is_product_category( array( 'engagement-rings', 'artcarved', 'demarco', 'gabriel-co', 'ajaffe', 'ritani-rings', 'askh

我目前有以下条件陈述-

<?php if ( is_front_page() || is_page_template( 'page-fullwidth.php' ) || is_product() ) { ?>

<?php } elseif ( is_product_category( array( 'engagement-rings', 'artcarved', 'demarco', 'gabriel-co', 'ajaffe', 'ritani-rings', 'askher', 'verragio-gallery', 'scott-kay-gallery', 'tacori-gallery', 'martin-flyer-gallery', 'henri-daussi-gallery', 'bez-ambar-gallery', 'art-carved-gallery', 'michael-m-ring-designer-gallery', 'womens-wedding-bands', 'designer-engagement-rings' ) ) ) { ?>
<div id="side-nav" class="three columns">
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Engagement Ring Sidebar')) : ?><?php endif; ?>
</div>

我的问题在于在我的elseif中添加一个“OR语句”来测试它是否是一个自定义Post类型的“产品”,其自定义分类为“钻石切割”或“戒指样式”

每个自定义分类法下也有子分类法

目前,该语句工作正常-但我希望能够将这些搜索结果页面包含到我的条件语句中,以便显示正确的内容

我不确定这个花絮是否会有帮助,但这是显示页面时地址栏中我的域之后的内容-“?post_type=product&diamond cut=round”

我希望每一个“钻石切割”和每一个“戒指样式”都包含在我的elseif中


我试过is_tax('diamond-cut'),但它不起作用。

它的功能是什么?这是您编写的自定义函数,还是WooCommerce函数?
diamond cut
elseis_product()是WooCommercediamond cut创建的帖子类型是主要分类法-ROUND是diamond cut的子分类法