<?php
$args = array(
//\'posts_per_page\' => 99,
\'post_type\' => \'course\',
\'category_name\' => \'Consectetur adipiscing elit sed do eiusmod\', //<-- custom post type category name, I have used it to find its content
\'orderby\' => \'date\',
//\'order\' => \'ASC\',
\'ignore_sticky_posts\' => 1,
\'paged\' => $paged);
$loop = new WP_Query($args);
if ($loop->have_posts()) :
while ($loop->have_posts()) : $loop->the_post();
the_title(sprintf(\'<li><a href="%s" rel="bookmark">\',
esc_url(get_permalink())), \'</a></li>\');
endwhile;
endif;
wp_reset_postdata();
?>
我用默认的帖子类型“post”尝试了这个方法,但没有类别名称。但在CPT、自定义帖子类型和自定义分类法的情况下,它并不起作用。