【发布时间】:2018-10-16 23:29:37
【问题描述】:
我正在开发一个服务 cpt,并希望在单个帖子的同一 cpt 中显示其他帖子的列表。
我使用的代码是:
<?php
$loop = new WP_Query( array(
'post_type' => 'services',
'posts_per_page' => 6
));
?>
<ul>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<h4><?php the_title(); ?></h4>
</a>
</li>
<?php endwhile; wp_reset_query(); ?>
</ul>
现在我的问题是,有没有办法在当前帖子中添加一个类?目的是将其样式与列表中的其他帖子不同。
【问题讨论】:
标签: php wordpress custom-post-type