WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Loop Question (2 posts)

  1. khaled
    Member
    Posted 7 years ago #

    Ok, so the multiple loop is up and running, I'm just having a bit of trouble trying to make it do something. I know it can be done (because I've done this before) but I think I did this using a plugin. I'm pretty sure this can be done using just the wp tags, just not sure how to go about it.

    I've got two loops. The first lets call it featured, while the second is basically a list of posts. When several posts within the second loop get posted in the same day, they should be placed under the same date tag.

    So basically the structure I'm thinking about is this:
    First Loop{
    Title of Post
    Date of Post
    main post}

    Second Loop{
    Date of posts
    First Post (not main post)
    second post (posted on same day as first post)

    Date of posts
    Third Post (posted on a different date to the first two posts)
    }

    Directly from this page:
    http://codex.wordpress.org/The_Loop

    <?php $my_query = new WP_Query('category_name=featured&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;?>
    <?php the_time('jS F, Y') ?>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>

    <?php endwhile; ?>
    <!-- Do other stuff... -->
    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    <?php the_excerpt(); ?>
    <?php endwhile; endif; ?>

    Now the question is how do I modify the second part of the loop so that it doesn't have the date for show up for every post. It collects them for that particular day?

  2. Samuel B
    moderator
    Posted 7 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags