Php wordpress函数查询帖子(';showposts=3&;cat=1';)显示4或5篇帖子,而不是3篇。为什么?

Php wordpress函数查询帖子(';showposts=3&;cat=1';)显示4或5篇帖子,而不是3篇。为什么?,php,wordpress,Php,Wordpress,我尝试使用wordpress函数query_posts('showposts=3&cat=1')来显示类别1下的最新帖子。但它显示4或5个帖子。你能帮我找出根本原因吗?谢谢 <?php query_posts('showposts=3&cat=17');?> <div class="n-placement n-widget w-image-text" data-type="image-text" id="u-aabm">

我尝试使用wordpress函数query_posts('showposts=3&cat=1')来显示类别1下的最新帖子。但它显示4或5个帖子。你能帮我找出根本原因吗?谢谢

<?php query_posts('showposts=3&cat=17');?>
            <div class="n-placement n-widget w-image-text" data-type="image-text" id="u-aabm">
                <div class="n-inner" id="u-aabm-i">
                    <div class="w-image-text-container">
                        <span class="w-image-text-image" style="float: left; clear: left; margin-top: 6px; margin-bottom: 6px; margin-right: 6px;">
                            <img src="<?php echo catch_that_image();?>" height="112" width="112"/>
                        </span>
                        <div class="w-image-text-text">
                            <b> 
                            <!--<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>-->
                            <?php the_title(); ?>
                       </b>
                            <div>
                                <div>
                                    <?php 
                                    if(is_category() || is_archive() || is_home() ) { 
                                        the_excerpt();
                                    } else {
                                        the_content('Read the rest of this entry &raquo;'); 
                                    } 
                                ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php endwhile; ?> 

“height=“112”width=“112”/>

定义查询后需要启动循环

因此,代码变成:

<?php query_posts('showposts=3&cat=17');
    while (have_posts()) : the_post(); ?>
            <div class="n-placement n-widget w-image-text" data-type="image-text" id="u-aabm">
                <div class="n-inner" id="u-aabm-i">
                    <div class="w-image-text-container">
                        <span class="w-image-text-image" style="float: left; clear: left; margin-top: 6px; margin-bottom: 6px; margin-right: 6px;">
                            <img src="<?php echo catch_that_image();?>" height="112" width="112"/>
                        </span>
                        <div class="w-image-text-text">
                            <b> 
                            <!--<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>-->
                            <?php the_title(); ?>
                       </b>
                            <div>
                                <div>
                                    <?php 
                                    if(is_category() || is_archive() || is_home() ) { 
                                        the_excerpt();
                                    } else {
                                        the_content('Read the rest of this entry &raquo;'); 
                                    } 
                                ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
 <?php endwhile; ?>

“height=“112”width=“112”/>

您是否尝试过此查询\u posts('posts\u per\u page=3');嗨,西斯马特,我刚才试过了,但没有成功。在执行查询之前,您是否重置了查询?开始时
在哪里,而
在哪里?您没有循环-