Problem with loops
-
Hi,
I’m hoping to get some help with condensing/correcting this code. Basically, what I want to happen is that it queries for the latest child of a category and only displays those posts. From there, if a post is say “featured” I want one thing to happen vs. say “sub-featured” where something else would happen. However, I want it to deal with the featured posts before it does anything to the sub-featured posts regardless of the posting order (I’m hoping this makes sense). Here’s the code:
<?php $category = get_categories('child_of=32&order=DESC'); $category = array_values($category); query_posts('cat=' . $category[0]->cat_ID); ?> <?php while ( have_posts() ) : the_post(); $do_not_duplicate = $post->ID; if ( in_category(41) ) { include(TEMPLATEPATH . '/featured.php'); } elseif ( in_category(43) ) { include(TEMPLATEPATH . '/sub-features.php'); } else { } ?> <div id="post-<?php the_ID() ?>" class="post"> <h3 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h3> <div class="clear"></div> </div><!-- #post --> <?php endwhile ?>
Any and all help would be greatly appreciated. Thanks in advance.
- The topic ‘Problem with loops’ is closed to new replies.