【发布时间】:2021-12-15 16:26:09
【问题描述】:
在 wordpress 中仅显示自定义帖子类型存档页面的父帖子
我的代码:
$args = array(
'post_type' => 'programs',
'post_parent' => get_the_ID(),
);
$article_posts = new WP_Query($args);
if($article_posts->have_posts()) :
?>
<?php while($article_posts->have_posts()) : $article_posts->the_post();
$post_id = get_the_ID();
$post_link = get_permalink($post_id);
$post_title = get_the_title();
$featured_img_url = get_the_post_thumbnail_url(get_the_ID());
?>
<p> post </p>
<?php endwhile; ?>
<?php else: ?>
Oops, there are no posts.
<?php endif; ?>
<?php echo "</ul>";?>
结果:
“糟糕,没有帖子。”
【问题讨论】:
标签: php wordpress wordpress-theming custom-post-type custom-wordpress-pages