Display posts in diff template layouts using loop within a loop
-
I want tmy theme to deiplay each post in a certain way depending on he catagory. The reason for this is I use the site to display my twitter updates too. Thisresults in lots of updates. So i want to make the twitter posts smaller than normal posts.
This is how the site displays posts at the moment:
Current LookThis is what it should look like:
New LookI appreciate that itb will involve some CSS but i ill deal with that once i have the Loop sorted. This is the code so far but it dosn’t work. I think i need to create a loop within the main loop.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $post = $wp_query->post; if ( in_category('28') ) { include(TEMPLATEPATH . '/tweet_cat.php’); } else { include(TEMPLATEPATH . '/cat.php'); } ? > <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?> <p><?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?></p>
tweet_cat.php and cat.php are 2 simple files displaying the relevant tags in the order they should be arranged in for the diffrent catagories.
I just don’t know how to code it to do this nor do i know if it’s beyond WP capabilities.
- The topic ‘Display posts in diff template layouts using loop within a loop’ is closed to new replies.