Difficult Conditional Loop Problems
-
I’ve been looking all over the forums and the web and I can’t figure out what to do. The loop is getting confusing because I’ve looked at it for so long.
Here’s what I’m trying to accomplish with my index.php
– 1 Featured Post that only shows on first (home page) page which is styled completely different and has extra content than just a regular post (ie: can’t use “sticky” feature)
– 8 More Posts. Each will be tagged as 1 of three things (so three different styles of posts). So I’d like the loop to say IF TAGGED THIS TYPE OF POST THEN SHOW THIS, IF TAGGED THIS TYPE OF POST THEN SHOW THIS, AND IF TAGGED THIS TYPE OF POST THEN SHOW THIS.Here’s the code I’m workin’ with…
<?php get_header(); ?> <?php if ( is_home() and !is_paged() ) { ?> <!--FEATURED --> <?php query_posts('tag=featured&showposts=1'); ?> <?php while (have_posts()) : the_post(); ?> <!--CONTENT --> <?php endwhile; ?> <!--END FEATURED --> <?php } ?> <!--LOOP TO GET 8 POSTS--> <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("offset=1&showposts=8&paged=$page"); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!------------ I DON'T KNOW WHAT TO PUT HERE ------------> <?php endwhile; ?> <!--END LOOP TO GET 8 POSTS--> <?php else : ?> <h2>Not Found</h2> <p>Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; ?> </div> <?php get_footer(); ?>Help would be greatly appreciated. Thank you!!
The topic ‘Difficult Conditional Loop Problems’ is closed to new replies.