Slider won’t work with custom query
-
I’m trying to set up a slider with the most recent posts from a certain category, but I can’t seem to get it to work.
When I use the regular loop, the slider works just fine, but as soon as I add the new query for the specific category, the slider won’t work anymore – even though the query seems to be working just fine, since I can see other posts – they’re just static and not sliding.
I’m using carouFredSel for the slider, and this is my code:
<div class="wrapper"> <div class="list_carousel responsive"> <ul id="desliza"> <?php $catquery = new WP_Query( 'cat=19' ); while($catquery->have_posts()) : $catquery->the_post(); ?> <li> <div class="feattitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title() ;?></a></div> <?php if ( has_post_thumbnail() ) {the_post_thumbnail('destaque', array( 'itemprop' => "image"));} else { ?> <img src="<?php bloginfo('template_directory'); ?>/images/base-thumb.png" alt="<?php the_title(); ?>" /> <?php } ?> </li> <?php endwhile; ?> </ul> </div> </div>
Alternative query I’ve tried:
<?php query_posts( 'cat=19' ); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
(And a couple other variations of this.)
What’s the issue, and how can I get the slider to display just one specific category? Thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Slider won’t work with custom query’ is closed to new replies.