Instead of the second loop, do the following:
-
Count the posts per date
-
Display them as you will
// Count the posts per date $count = []; foreach ( $posts as $post ) { $date = get_the_date( 'Y-n-j', $post ); $count[ $date ] = ! isset( $count[ $date ] ) ? 1 : $count[ $date ] + 1; }
Related Posts:
- How to get posts published between a date and today?
- Count singular post views automatically
- Alternate custom content in the loop
- Double count view in archive.php
- How to get posts published on the latest date?
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Count singular post views automatically
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Alternative content between posts no repetition
- How to control Post view count incresing in sidebar widget posts too?
- Skip posts, but keep posts per page
- Print Current Post Index number within Loop
- Should we trust the post globals?
- How to mark every 3rd post
- How to get post creation date?
- Changing the post date and time with function
- Count posts within a custom post type and specific taxonomy and terms?
- How to Display a List of Users Who Have Made at Least 1 Post?
- How set featured posts using checkbox in post edit screen?
- Get first post from wp_query
- How to Display Network Post Count?
- Do we still need to include a “if (have_posts())” in templates?
- WP_Query: Why is sticky post not first item in loop?
- Is it possible to Schedule Attachments in WordPress?
- Query *only* sticky posts
- Display all posts from specific categories on a page
- using wp_update_post on save_post
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Skip post in loop and mixin later
- How to show list of posts by author and category?
- Override the default number of posts to show for a single loop?
- get comments and get posts in loop
- How to cache a shortcode functions output?
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- How to put last edited entry on top of the blog-post list?
- Display content from a specific category
- Count posts in category including child categories
- Query posts from current year
- Reverse chronology of post listing
- Why do I need to use The Loop on pages (inside page.php etc)?
- posts page – different lengths of excerpt
- WordPress Number of Posts Not Changing With posts_per_page
- how to display full post with pagination on home page
- Update existing post dates to random dates
- Looping through posts per category gives same posts for each category
- featuring old articles without messing up with the archive
- Find most recent authors
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Set font size automatically according to number of words in post
- Display All Sticky Post Before Regular Post
- Cannot access current post’s ID in custom plugin
- Can’t show comments count per post outside loop
- Get the author of the latest revision
- How to have different content in the loop and single
- Network wide post count (WP Multisite)
- Specific loop in Shortcode
- Strange switch_to_blog() issue
- Show a list of recently viewed posts to a user
- Multiple loops in same page, without duplicate content
- How to display an icon when a new post is published and then remove it when a specific time past?
- Redirect based on user post count
- loop not displaying posts on custom template page
- Repost post on specific date every year
- How to use alternate post layout at key points in post loop?
- How to output comments number of a post per day?
- Human Time Diff, change mins to minutes
- Showing random content / pictures from earlier posts in a sticky post?
- Display custom post types by date field
- Search widget breaks when using multiple loops?
- How to Display Post View Count
- How can I display a specific user’s first published post?
- Show that current post is number X out of X
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- Can wordpress differentiate between added and updated posts?
- Fetch posts from current week (Sunday to Saturday)
- Display Latest Post from all Categories
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Auto Refresh Post List after X seconds
- The correct way to call posts with ajax
- get_queried_object error How to show post count by month in the taxonomy page
- custom wordpress post loop – hide iframe content
- Divide Loop Into Days & Categories
- Converting multiple loops into one single loop with pagination
- Display posts with comments closed, with pagination?
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Group posts by year in loop
- How would I get 1 latest post from a query for 5 posts?
- Count to how many categories a post belongs to
- While in “the loop”, detect if a post is the most recent
- Alternating post layout
- Check to see if specific loop has less than certain amount of posts
- Different style for most recent article
- Contact form 7 post loop [closed]
- Differentiate between posts and pages in search results
- Count total number across post types
- Related posts loop based on tags AND categories doesn’t work without at least one tag assigned
- Loop through all product posts?
- Count search results in heading
- How to display different number of posts