Stick post loop from example code does not work
-
Hi all, I have on my index.php code the following loop codee directly from the docs https://codex.www.ads-software.com/The_Loop. It worked before upgrading to the newwest version 2.1. It doesn not “showpost” of just 1 item that is in a cat “Featured”, but instead it shows muliple items. And some of those items are not even in that cat.
What I would like to do is show one item (featured) with excerpt as first item then list the rest below it in an different list type.<?php $my_query = new WP_Query('category_name=Featured&showposts=1'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;?> <!-- <?php trackback_rdf(); ?> --> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="postcontent"> <p><?php the_excerpt(); ?> </p> </div> </div> <?php endwhile; ?> <h1>Recent Articles</h1> <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue;?> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <div class="postInfo"> <p><?php the_excerpt(); ?> </p> </div> <?php endwhile; ?> <?php else : ?>
- The topic ‘Stick post loop from example code does not work’ is closed to new replies.