SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jul 2006
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Wordpress Multiple Loops Breaking....Help!

    I have the following code which is meant to have 3 loops in it, top middle and bottom.

    However, when viewed its all broken and not displaying right.

    PHP Code:
    <?php
    /*
    Single Post Template: Event Detail
    Description: Main page for final drill down of event!
    */
    ?>


    <?php get_header(); ?>

     <ul class="banner_ad">
    <?php query_posts('cat=14'); ?>  
    <?php while (have_posts()) : the_post(); ?> 
    <li><?php the_content(); ?></li>                
    <?php endwhile;?>  
     </ul> 
     
     
    <?php rewind_posts(); ?>  
    <!--end first Loop?-->

        
        <?php if (have_posts()) : ?>

            <?php while (have_posts()) : the_post(); $data get_post_meta$post->ID'key'true ); ?>    
        
    <div id="detail_holder">    
        
        
    <div id="detail_image">    

    <img src="http://jezthompson.co.uk/ransom_note/wp-content/uploads/<?php echo $data'event_image' ]; ?>" alt = "work image"/>
    </div>
    <!--detail_image-->    


    <div id="detail_right">
            
                    <?php $content split("<!--more-->"$post->post_content);?>
                
                <div id="detail_right_title">
                <div id="detail_holder_inner_cat<?php $category get_the_category(); echo $category[0]->cat_ID;?>">
                
                <ul>
                <li><?php the_title(); ?></li>
                <li><?php echo $data'event_date' ]; ?> </li>
                <li><?php echo $data'event_location' ]; ?> &raquo; <?php echo $data'event_time' ]; ?></li>
                
                </ul>
                
                </div>
                <!--detail_holder_inner-->
                        
                </div>
                <!--detail_right_title-->
                
                <div class="content_box">            
                <?php echo apply_filters('the_content'$content[0]); ?>
                <?php echo apply_filters('the_content'$content[1]); ?>
                </div>
                <!--text content-->
                
                <div class="content_box">
                <p><a href="mailto:blank?body=The article '<?php the_title(); ?>' has been sent to you. You can view it at: <?php the_permalink() ?>" title="E-mail this item to a friend">Send to a friend</a></p>
                </div>
                <!--send to friend-->
                
                <div class="content_box">
                <?php echo apply_filters('the_content'$content[2]); ?>
                </div>
                <!--links-->
                            
                <div class="content_box">            
                            
                <ul class="prev_nxt">
                <li class="jFlowPrev"><?php previous_post_link('&laquo; %link'?></li>
                <li class="jFlowNext"><?php next_post_link('%link &raquo;'?></li>
                </ul>
                </div>
                <!--next/previous-->
                            
                        
                        <?php endwhile; ?>
        <?php endif; ?>
                        
        
    <div class="clearFix"><!--x--></div>            
    </div>
    <!--detail_right-->    
                 
                    
        <div class="clearFix"><!--x--></div>                
    </div>
    <!--detail_holder-->    
        
        
        <?php rewind_posts(); ?>  
    <!--end middle Loop-->


     <ul class="lowerbanner">
    <?php query_posts('cat=11'); ?>  
    <?php while (have_posts()) : the_post(); ?> 
    <li><?php the_content(); ?></li>                
    <?php endwhile;?>  
     </ul> 


    <?php get_footer(); ?>
    I dont understand as i've used the 3 loops on other pages, with only the centre one changing on this page its messed it all up.

    Any ideas?

  2. #2
    SitePoint Addict
    Join Date
    Jul 2006
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorted myself with the aid of this tutorial and this bit of code.

    PHP Code:
    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( 
    $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    My second loop was repeating the first one, not showing its own, so i found that added ...and it then printed its own and ignored the first one.

    Woooo Hoooo


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •