为小部件设置可见性条件-我需要它应用于特定术语中的帖子,但仅适用于;“待定”;和;“发布”;地位这实际上隐藏了;添加新帖子;按钮,如果他们在该期限内已经有一篇待处理或已发布的帖子。我只是无法正确定义这两种状态。我只能定义1,它工作得很完美。
$type = \'my_cpt\';
$tax = \'my_tax\';
$term_name = \'my_term\';
$term_id = 133;
$args = array(
\'post_type\' => $type,
\'author\' => get_current_user_id(),
\'post_status\' => array( \'pending\', \'publish\' ),
\'tax_query\' => array(
array(
\'taxonomy\' => $tax,
\'field\' => $term_name,
\'terms\' => $term_id,
\'include_children\' => false
)
)
);
$jobs = get_posts( $args );
if(count($jobs) >= 1){?>
<center>
<?php echo ("You currently have ".count($jobs)." active Final Submission. Please delete it to add another one.");
return true;
}?>
</center>