1
我之前做过很多WordPress的网站,但这是我遇到过的最奇怪的事情。我的WordPress的帖子标题随着每一个新帖子发生变化
当我发布第一篇文章时,一切看起来都不错,当我发布另一篇文章标题和旧文章的缩略图更改为像第二篇文章。
我的网站feedbaks.com
,这就是在index.php的一部分
<?php get_header(); ?>
<div id="body">
<div class="content-container">
<?php
if (have_posts()) :
while (have_posts()) : ?>
<?php
// check if the post has a Post Thumbnail assigned to it.
if (has_post_thumbnail()) {
the_post_thumbnail();
}
?>
<div class="content">
<h2 id="post-title">
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php
$cats=get_the_category();
echo $cats[0]->cat_name;
?> : <?php the_title(); ?></a></h2>
<div class="comments"><?php the_post(); comments_popup_link('0', '1', '%'); ?></div>
请帮我
在此先感谢
如果我添加'the_post();'该页面只是混合起来 你是什么意思太晚了? – Faisal
哦,我得到你我通过在循环后面插入“
”来解决它 – Faisal该函数设置了许多不同的值。如果没有它,一些模板标签往往不能正常工作,所以它真的应该出现在循环的开始处,就像WordPress codex中的示例一样(请参阅我的链接)。你在循环的底部,就在打印评论之前。如果把它放在最上面就会让你的页面变得乱七八糟,那么别的地方就会出现问题。您将它添加到顶部,并在评论之前将其删除,对吗?它应该只在循环中一次。 –