WordPress.org

Ready to get started?Download WordPress

Forums

loop is recurring (4 posts)

  1. cloverImg
    Member
    Posted 2 years ago #

    I am trying to create a documents page that displays the first 10 post titles in a category with a small icon next to each title. I have added all my css and everything is looking fine, but it keeps repeating the loop when I only need it to show 1 time. I have looked through this and maybe I've just been looking at it too long, but I can't figure out how to break out of the loop. In the end there will be 6 categories shown in individual boxes. Here is what the code looks like:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. cloverImg
    Member
    Posted 2 years ago #

    here is the code ... http://pastebin.com/eK10vz7D

  3. Oleg Dudkin
    Member
    Posted 2 years ago #

    Hi,
    You have
    foreach($bp_posts as $post) : setup_postdata($post);
    inside main loop
    while ( have_posts() ) : the_post()

    so it's repeating with every iteration of main loop.
    Just move your code out.

  4. cloverImg
    Member
    Posted 2 years ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags