我有一个循环,我用它来显示新闻类别的帖子,如果我点击标题,缩略图和阅读更多,它应该能够指引我到相对帖子。永久链接去404页
我的循环如下所示:
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 3,
'category_name' => 'news'
);
$query = new WP_Query($args);
while($query->have_posts()) : $query->the_post();
?>
<div class="news_box_content">
<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
<figure><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></figure>
<?php if($post->post_excerpt) { ?>
<p><?php echo substr(get_the_excerpt(), 0,300); ?></p>
<a href="<?php the_permalink(); ?>">Read more...</a>
<?php } else {
echo get_excerpt();
} ?>
</div>
<?php endwhile; wp_reset_postdata(); ?>
所有作品,除了阅读更多链接罚款。
问题是,当我点击阅读更多内容时,它会将我引导至404页面而不是帖子内容。
我该如何解决这个问题?
在标题工程中的永久链接佩尔利? – Exprator
是的,它工作正常 –