我的wordpress帖子的标题随着每个新帖子的变化而变化

时间:2012-10-13 18:05:13

标签: php html html5 wordpress dynamic-websites

之前我做了很多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>

请帮帮我

提前致谢

1 个答案:

答案 0 :(得分:1)

Your Loop is missing a function.您需要the_post(),如下所示:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

我相信添加会解决您的问题。

[edit]实际上,the_post()并不缺失。这个功能太迟了。在评论之前,您不会运行它。

相关问题