WordPress.org

Support

Support » How-To and Troubleshooting » WordPress Custom Loop

WordPress Custom Loop

  • I have to create a loop of the top 5 posts falling under any 1 or more of a set of categories. I have browsed the support forums and tried out all combinations. It is not working for me.

    One odd output I got was that posts 2,4,6,8,10 that were falling under any 1 or more of the set of categories were displayed. Instead of the top 5 posts (1,2,3,4,5). The loop was skipping every alternate post.The code I used was as follows:

    query_posts('category_name=cat1,cat2');
    $ctr=1; while (have_posts() && $ctr<6) : the_post(); { $ctr++ ?>
    ---
    ---
    }?>

    Please provide the code for achieving this custom loop.

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress Custom Loop’ is closed to new replies.
Skip to toolbar