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
- How to Display Network Post Count?
- Do we still need to include a “if (have_posts())” in templates?
- Query *only* sticky posts
- Cannot access current post’s ID in custom plugin
- Can’t show comments count per post outside loop
- Show a list of recently viewed posts to a user
- Redirect based on user post count
- How to output comments number of a post per day?
- Auto Refresh Post List after X seconds
- Display posts with comments closed, with pagination?
- Count total number across post types
- Related posts loop based on tags AND categories doesn’t work without at least one tag assigned
- Display post from specific date
- pre_get_posts query between 2 dates (date stored in custom post meta)
- How To Get Posts With A Specific Word
- How to display posts on a static page? (like search loop)
- Why WP_Query(‘showposts=5’) shows only 1 post?
- WordPress Loop – Next 3 Posts
- problems with loading posts in a table-row
- Update all comments time to random dates?
- WP Query – Posts Per Page not working in combination with category__in
- How can I get global $post to work for CPT and update user?
- More then one menu items are assigned with “current-menu-item” class
- Pulling in post category and children within category
- Listing Specific Categories from Current Post with Depth
- How to exclude visited posts from loop
- get_the_category listing in hierarchial order
- Worpdress function for difference dates
- Exclude current custom post on single post
- add to end of post in the loop with plugin
- Changing default WP-Site creation date
- Custom taxonomy archive page problem
- Add custom text automatically on each post
- Getting blog pagination to work on page set as front page
- Make loop inside slider divisible [closed]
- What date to use as a post date? date_gmt or modified_date_gmt
- Display current post position in Elementor Posts widget
- Get post number both in the loop and in the post
- Count the number of a post types associated with another post type
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- Some doubts about how the loop work (trying debugging it)
- Date is wrong on ‘all posts’ page
- If custom field is empty, use one from a previous post
- Get post category as a separate string and url
- Display 3 posts with different HTML markup using a loop
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- How to repeat a loop after 4 posts [duplicate]
- How to separate each individual blog post?
- How to show full post on home page
- ACF flexible content block not showing on live site (works locally)
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Set post title font size automatically according to number of words in post title
- How to show post views shortcode data for each post on Posts List Page?
- Set a post expiration and delete a post when expirate
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- How to hide meta from search result only on pages?
- How do I display posts ordered by a date custom field?
- How to show category image if no featured image is set?
- Get post id outside loop : Notice: Trying to get property of non-object
- Can I Paginate Post after every 25 tag?
- Post being duplicated with foreach loop
- Start loop from specific post ID
- Custom post type – Loop out in random order but same 15 to appear first… still random
- WordPress infinite post cycle
- WordPress Request Post All Post ID in a Loop? [closed]
- WordPress loop uses unmodified posts array, why?
- Add row after three columns
- Post Format problem
- Modify WordPress loop after it has been run
- index.php is only displaying current month’s posts?
- Loop doesn’t display posts. It displays a link to the home page instead
- Grab next post title in archive page
- Getting posts from multiple users?
- How to organise post by category and date
- Show post if in category
- Adding a category at even positions on main loop with modified pagination
- Displaying categories items among posts
- Display metabox with date
- The loop: more posts than I want to fit on one page
- Index.php is ordering posts strangely
- Show all posts in category
- First post in loop displays twice
- What function does the loop of displaying posts?
- Count words for all posts by all authors
- Word count for all posts of all authors
- Display post count on archive page in reverse order
- Count the number of matching post names in foreach loop