Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Recently I made a theme for my wordpress blog. Now I wanna filter(remove) my 5 latest post from the main page(index.php) and show them into slider. Now my 5 latest posts are showing in the first page and slider simultaneously :(

Pleas help Thanks

Update:

Thanks for your reply. I couldn't solve my problem. this is my index.php source:

<?php get_header() ?>

<div id="main-wrapper">
    <div class="middle-content">
        <div id="sidebar-right">
            <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-right')) : else : ?>
            <?php endif; ?>
        </div>
        <section class="clearfix" id="content">
            <section id="main-content">
                <?php echo get_touchcarousel(2); ?>
                <div class="mainnews"><h2>Latest News</h2></div>
                <div class="main-menu-content">
                    <?php if(have_posts()) : ?>
                        <?php while (have_posts()) : the_post(); ?>
                            <article id="etc" class="post<?php the_category_unlinked(' '); ?>">
                                <div class="post-content">
                                    <div class="post-title">
                                        <a href="<?php the_permalink(); ?>"><h1><?php the_title(); ?></h1></a>
                                    </div>
                                    <div class="clear"></div>
                                    <?php the_excerpt(); ?>
                                    <?php the_post_thumbnail(array(260,140), array ()); ?>
                                </div>
                                <div class="clear"></div>
                            </article>

                        <?php endwhile; ?>
                    <?php endif; ?>
                </div>
                <?php if(function_exists('wp_simple_pagination')) {
                    wp_simple_pagination();
                } ?>
            </section> 
            <div id="sidebar-left">
                <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-left')) : else : ?>
                <?php endif; ?>
            </div>
        </section>
    </div>
    <div class="clear"></div>
    <?php get_footer(); ?>
</div>
</section>
</div>
<div class="clear"></div>
<?php get_footer(); ?>

Would you please help me?

share|improve this question
    
can you provide the code of the first page template? is the slider code in the same template as the loop? –  Michael Dec 7 '12 at 11:31
    
You probably need to add wp_reset_postdata() or wp_reset_query() at the end of your loop. –  RRikesh Dec 7 '12 at 12:24
add comment

2 Answers

Please check whether you have added wp_reset_query() while ending the loop. Moreover, you can also check whether you have added offset attribute properly to your query_posts.

share|improve this answer
add comment

I don't know if WP has a built in feature for it's query but you could do something like this:

$count = 0;
if(have_posts()) : while (have_posts()) : the_post();
if ($count < 4 ) { $count++; }
else { ... your blogroll code ... } 
endwhile; endif;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.