Support » Fixing WordPress » Two sliders appearing on page 2?

  • I’ve created a site for my friend and everything has been working great, went to do some updates today and came across a strange error on this page…

    http://pixelpopuli.com/category/free-stuff/page/2/

    As you can see the slider is appearing twice, or at least the thumbnails for it are, and I’m befuddled as to why…

    Here is the code I’m using to call the slider, it’s a pretty basic if in x category display x slider kind of thing, with multiple categories.

    <?php if (is_category('2') || in_category('2')) { ?>
    
        <?php $number = 0; query_posts('cat=976&showposts=4'); if(have_posts()): ?>
    		<div id="myCarousel" class="carousel slide pp-slider hidden-xs">
    
                <div class="slide-thumbs">
                    <div class="slide-thumbs-row">
                        <ol class="carousel-indicators">
                            <?php while(have_posts()): the_post(); ?>
                                <li data-target="#myCarousel" data-slide-to="<?php echo $number++; ?>"><?php the_title(); ?></li>
                            <?php endwhile; ?>
                        </ol>
                    </div>
                </div>
    
                <div class="carousel-inner">
                    <?php while(have_posts()): the_post(); ?>
                        <div class="item">
                            <?php the_post_thumbnail('home-slide'); ?>
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                                <div class="carousel-caption">
                                    <div class="slide-wrap">
                                    <h4><?php the_title(); ?></h4>
                                    </div>
                                </div>
                            </a>
                        </div>
                    <?php endwhile; ?>
                </div>
                <a class="carousel-control left" href="#myCarousel" title="Previous" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span><p class="cc-txt">Previous</p></a>
                <a class="carousel-control right" href="#myCarousel"  title="Next" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span><p class="cc-txt">Next</p></a>
    		</div>
    
    		<?php endif; wp_reset_query(); ?>
    
    <?php } ?>
    
    <?php if (is_category('4') || in_category('4')) { ?>
    
        <?php $number = 0; query_posts('cat=977&showposts=4'); if(have_posts()): ?>
    		<div id="myCarousel" class="carousel slide pp-slider hidden-xs">
    
                <div class="slide-thumbs">
                    <div class="slide-thumbs-row">
                        <ol class="carousel-indicators">
                            <?php while(have_posts()): the_post(); ?>
                                <li data-target="#myCarousel" data-slide-to="<?php echo $number++; ?>"><?php the_title(); ?></li>
                            <?php endwhile; ?>
                        </ol>
                    </div>
                </div>
    
                <div class="carousel-inner">
                    <?php while(have_posts()): the_post(); ?>
                        <div class="item">
                            <?php the_post_thumbnail('home-slide'); ?>
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                                <div class="carousel-caption">
                                    <div class="slide-wrap">
                                    <h4><?php the_title(); ?></h4>
                                    </div>
                                </div>
                            </a>
                        </div>
                    <?php endwhile; ?>
                </div>
                <a class="carousel-control left" href="#myCarousel" title="Previous" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span><p class="cc-txt">Previous</p></a>
                <a class="carousel-control right" href="#myCarousel"  title="Next" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span><p class="cc-txt">Next</p></a>
    		</div>
    
    		<?php endif; wp_reset_query(); ?>
    
    <?php } ?>
    
    <?php if (is_category('694') || in_category('694')) { ?>
    
        <?php $number = 0; query_posts('cat=978&showposts=4'); if(have_posts()): ?>
    		<div id="myCarousel" class="carousel slide pp-slider hidden-xs">
    
                <div class="slide-thumbs">
                    <div class="slide-thumbs-row">
                        <ol class="carousel-indicators">
                            <?php while(have_posts()): the_post(); ?>
                                <li data-target="#myCarousel" data-slide-to="<?php echo $number++; ?>"><?php the_title(); ?></li>
                            <?php endwhile; ?>
                        </ol>
                    </div>
                </div>
    
                <div class="carousel-inner">
                    <?php while(have_posts()): the_post(); ?>
                        <div class="item">
                            <?php the_post_thumbnail('home-slide'); ?>
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                                <div class="carousel-caption">
                                    <div class="slide-wrap">
                                    <h4><?php the_title(); ?></h4>
                                    </div>
                                </div>
                            </a>
                        </div>
                    <?php endwhile; ?>
                </div>
                <a class="carousel-control left" href="#myCarousel" title="Previous" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span><p class="cc-txt">Previous</p></a>
                <a class="carousel-control right" href="#myCarousel"  title="Next" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span><p class="cc-txt">Next</p></a>
    		</div>
    
    		<?php endif; wp_reset_query(); ?>
    
    <?php } ?>
    
    <?php if (is_category('693') || in_category('693')) { ?>
    
        <?php $number = 0; query_posts('cat=979&showposts=4'); if(have_posts()): ?>
    		<div id="myCarousel" class="carousel slide pp-slider hidden-xs">
    
                <div class="slide-thumbs">
                    <div class="slide-thumbs-row">
                        <ol class="carousel-indicators">
                            <?php while(have_posts()): the_post(); ?>
                                <li data-target="#myCarousel" data-slide-to="<?php echo $number++; ?>"><?php the_title(); ?></li>
                            <?php endwhile; ?>
                        </ol>
                    </div>
                </div>
    
                <div class="carousel-inner">
                    <?php while(have_posts()): the_post(); ?>
                        <div class="item">
                            <?php the_post_thumbnail('home-slide'); ?>
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                                <div class="carousel-caption">
                                    <div class="slide-wrap">
                                    <h4><?php the_title(); ?></h4>
                                    </div>
                                </div>
                            </a>
                        </div>
                    <?php endwhile; ?>
                </div>
                <a class="carousel-control left" href="#myCarousel" title="Previous" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span><p class="cc-txt">Previous</p></a>
                <a class="carousel-control right" href="#myCarousel"  title="Next" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span><p class="cc-txt">Next</p></a>
    		</div>
    
    		<?php endif; wp_reset_query(); ?>
    
    <?php } ?>
    
    <?php if (is_category('692') || in_category('692')) { ?>	
    
        <?php $number = 0; query_posts('cat=980&showposts=4'); if(have_posts()): ?>
    		<div id="myCarousel" class="carousel slide pp-slider hidden-xs">
    
                <div class="slide-thumbs">
                    <div class="slide-thumbs-row">
                        <ol class="carousel-indicators">
                            <?php while(have_posts()): the_post(); ?>
                                <li data-target="#myCarousel" data-slide-to="<?php echo $number++; ?>"><?php the_title(); ?></li>
                            <?php endwhile; ?>
                        </ol>
                    </div>
                </div>
    
                <div class="carousel-inner">
                    <?php while(have_posts()): the_post(); ?>
                        <div class="item">
                            <?php the_post_thumbnail('home-slide'); ?>
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                                <div class="carousel-caption">
                                    <div class="slide-wrap">
                                    <h4><?php the_title(); ?></h4>
                                    </div>
                                </div>
                            </a>
                        </div>
                    <?php endwhile; ?>
                </div>
                <a class="carousel-control left" href="#myCarousel" title="Previous" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span><p class="cc-txt">Previous</p></a>
                <a class="carousel-control right" href="#myCarousel"  title="Next" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span><p class="cc-txt">Next</p></a>
    		</div>
    
    		<?php endif; wp_reset_query(); ?>
    
    <?php } ?>

    This doesn’t seem to happen on the second page of any of the other categories which has left me stumped.

    Any ideas anybody? Also if anyone can suggest a better way to write this particular chunk of code I’m all ears!

  • The topic ‘Two sliders appearing on page 2?’ is closed to new replies.