列出带有特定标记的自定义帖子类型(wordpress)
所以这让我快发疯了 我可以很容易地列出所有带有特定标签的帖子标题,如下所示:列出带有特定标记的自定义帖子类型(wordpress),wordpress,tags,custom-post-type,Wordpress,Tags,Custom Post Type,所以这让我快发疯了 我可以很容易地列出所有带有特定标签的帖子标题,如下所示: <?php query_posts( 'tag=products' ); if ( have_posts() ) while ( have_posts() ) : the_post(); echo "<h1>" . the_title() . "</h1>"; endwhile; wp_reset_query(); ?> 但这只适用于所有标准职位。如果仅针对某个自定义帖子类
<?php
query_posts( 'tag=products' );
if ( have_posts() ) while ( have_posts() ) : the_post();
echo "<h1>" . the_title() . "</h1>";
endwhile;
wp_reset_query(); ?>
但这只适用于所有标准职位。如果仅针对某个自定义帖子类型(我的自定义帖子类型称为“产品”)执行此操作,我需要做什么。换句话说,它应该显示所有“产品”自定义帖子类型的标题,这些类型也有标签“webonly”
任何建议都会有帮助
显示添加webonly标签的所有帖子列表
notice-tag = your tag taxonomy name
terms in define your tag slug name
'post_type'=>'notice', in define your post type
显示添加webonly标签的所有帖子列表
notice-tag = your tag taxonomy name
terms in define your tag slug name
'post_type'=>'notice', in define your post type
Bingo。只需要在最后重置查询,现在一切都好了。非常感谢!我不知道为什么这是公认的答案。在上面的查询中,“post_type”被忽略。如果删除“税务查询”,则不会忽略“post类型”。宾果。只需要在最后重置查询,现在一切都好了。非常感谢!我不知道为什么这是公认的答案。在上面的查询中,“post_type”被忽略。如果删除“税务查询”,则不会忽略“过账类型”。