Support » Themes and Templates » My Loop ain't Runnin!

  • Resolved kortschot

    (@kortschot)


    Can anybody shed some light on my Loop… the second part posts the permalink of the page instead of the remaining posts in the category…. I must be doing something wrong.

    <div id="main-content-werk">
    
            <div id="slider">
              <?php $my_query = new WP_Query('category_name=werk&posts_per_page=3');
               while ($my_query->have_posts()) : $my_query->the_post();
               $do_not_duplicate = $post->ID;?>
               <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><img src="<?php echo get_post_meta($post->ID, 'slider-image', true); ?>" alt="" title="<?php the_title(); ?>" /></a>
               <?php endwhile; ?>
             </div> <!-- END slider -->
    
             <br clear="all" />
    
            <?php if (have_posts()) : while (have_posts()) : the_post();
            if( $post->ID == $do_not_duplicate ) continue; ?>
              <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    
            <!-- Do stuff... -->
    
            <?php endwhile; endif; ?>
    
        </div> <!-- end main-content-werk -->
Viewing 11 replies - 1 through 11 (of 11 total)
  • Chip Bennett

    (@chipbennett)

    You’re running two separate Loops.

    Try adding a wp_reset_query() between them?

    kortschot

    (@kortschot)

    yeah I did, thought it was still in there, not workin either. I used the codex page for multiple loops.

    here’s the full code of the page.

    http://pastebin.com/Wsf4g3Z1

    Chip Bennett

    (@chipbennett)

    Do you need to globalize $do_not_duplicate?

    You might try one of the other forums, e.g. WP-Advanced. You might have better luck having someone with more expertise with multiple Loops see/answer your question?

    kortschot

    (@kortschot)

    Thanks for the advice, ill check it out.
    The forum is closed though.. only moderators can paste threads there.

    Chip Bennett

    (@chipbennett)

    Strange. I don’t know what better forum to suggest, then. Maybe “How-To and Troubleshooting”, or “Plugins and Hacks”?

    kortschot

    (@kortschot)

    Thanks, ill repost it.

    Michael

    (@alchymyth)

    Forum Moderator

    http://pastebin.com/uH5UG154

    no guarantee 😉

    kortschot

    (@kortschot)

    wht do you mean…

    edit: oh =)

    ill check it out

    kortschot

    (@kortschot)

    oh dude!

    If you where a girl!

    thanks a bunch m8! works like a charm!

    Michael

    (@alchymyth)

    Forum Moderator

    If you where a girl!

    no chance – no flowers please – i prefer a drink 😉

    kortschot

    (@kortschot)

    beer it is =)

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘My Loop ain't Runnin!’ is closed to new replies.