Support » Themes and Templates » Multiple Complicated Loops

  • Resolved kennethwatt

    (@kennethwatt)


    Hi guys

    I have a div section at the top of a page, and then another one below, and I want the top one to display a list of 6 titles of all posts, except ones in category 13. Also, how do you end this loop.
    I so far have for this div section:

    <?php if (have_posts(3)) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    <?php endwhile; ?>

    I also want the second div section to display a list of 10 posts (I have the code required to go in between the loop stuff)in all categories except in the featured category. Likewise, how should I go about ending this loop.
    I so far have for this:

    <?php if (have_posts()) : ?>
    			<?php while (have_posts()) : the_post(); ?>
    				<div class="post" id="post-<?php the_ID(); ?>">
    					<div class="postwrapper">
    						<a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading the rest of this entry »"><img src="<?php $key="thumbnail"; echo get_post_meta($post->ID, $key, true); ?>" alt="thumbnail" class="thumbnail" /></a>
    						<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    						<div class="entry">
    							<?php the_excerpt(); ?>
    						</div>
    					</div>
    					<div class="postmetadata">
    						<span class="thetime"><?php the_time('F jS, Y') ?></span>
    						<span class="thecategory"><?php the_category(', ') ?></span>
    						<?php edit_post_link('Edit', '<span class="editthispost">', '</span>'); ?>
    						<span class="thecomments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span>
    						<div class="readmore">
    							<a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading the rest of this entry »">Read More</a>
    						</div>
    					</div>
    				</div>
    
    		<?php endwhile; ?>
    
    				<div class="navigation">
    					<div class="navleft"><?php next_posts_link('Older Entries') ?></div>
    					<div class="navright"><?php previous_posts_link('Newer Entries') ?></div>
    				</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>

    Any help would be much appreciated

    Kenneth

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple Complicated Loops’ is closed to new replies.