【问题标题】:Wordpress shows duplicated recent postsWordpress 显示重复的最近帖子
【发布时间】:2015-07-12 19:46:40
【问题描述】:

我使用 underscores_me 作为主题启动器。我想在我的首页显示最近的 3 个帖子。但不是作为侧边栏,而是作为我的主要内容。以 200 个文本为摘录,按日期降序排列。

我一直在网上阅读,我一直在应用我能找到的所有解决方案,但它们都提供了 3 个最近的帖子,但它被重复了 10 次。

<ul>

<?php
$Poz = array(

    'orderby' => 'date',
    'order' => 'DESC',
    'no_found_rows' => true,
    'update_post_term_cache' => false,
    'update_post_meta_cache' => false,
    'post__not_in' => $do_not_duplicate,
    'posts_per_page' => 3,
);

query_posts( $Poz );


while ( have_posts() ) : the_post(); ?>
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?> yazısını oku."><?php the_title(); ?></a></li>
<?php  endwhile;  wp_reset_query();
?>

示例:http://imgur.com/xBxw12J

请帮帮我

【问题讨论】:

    标签: wordpress post


    【解决方案1】:

    在屏幕截图中,整个 &lt;ul&gt; 似乎被复制了 - 所以问题不在上面的代码中。

    某些东西在上面的代码中循环了 10 次 - 这段代码在哪个文件中,从哪里调用它?

    【讨论】:

    • 感谢您的回复。我正在编辑 content.php。然后我注意到 index.php 中也有一个循环。这就是它重复的原因。谢谢,现在我得到了解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 2012-11-15
    相关资源
    最近更新 更多