Clever manipulation of your Loop code should prevent having to make numerous additional requests to the database. Proof of concept:
$args = array(
'post_type' => 'post'
);
$qry = new WP_Query($args);
if ($qry->have_posts()) {
$date = $count = 0;
$content="";
while ($qry->have_posts()) {
$qry->the_post();
$tdate = mysql2date('Y-m-d',$post->post_date);
if ($date != $tdate) {
if ($date != 0) {
echo $date.' ('.$count.' Posts)';
echo '<br>';
echo $content;
echo '<br>'.str_repeat('-',50).'<br>';
}
$content="";
$count = 0;
$date = $tdate;
}
$content .= '<br>'.get_the_title();
$count++;
}
}
Related Posts:
- Stop WordPress automatically adding tags to post content
- Print Current Post Index number within Loop
- Front-End Post Submission
- How To Disable (or Remove) “All Posts, Published, and Trash” in Dashboard Posts
- how to get a different html for odd/even posts?
- How to manually link posts to each other in WordPress
- Post/Page Publish/Update button not clickable once I make an edit
- How do I create a link that will always show the latest post?
- How to display posts by current user/author in a custom page template?
- Display all search results
- $post->ID not working
- featuring old articles without messing up with the archive
- Add default content to post (for specific category)
- Setting pagination for images attached to a post
- Is there a plugin that creates a WP post based on a Twitter account’s hashtag?
- blog page showing only first post
- Is it possible to show a different WP menu when using password protected pages?
- Human Time Diff, change mins to minutes
- POST from jQuery to PHP
- get_post_custom stripping styling issue
- Including text at the end of every post
- same template for multiple custom post type single
- Redirect before post page
- Fetch posts from current week (Sunday to Saturday)
- Allowing the SoundCloud player to appear in a post excerpt
- Display the Content of a Post with qTip2
- Scheduled posting not working
- Converting multiple loops into one single loop with pagination
- How to set post expiration date and time and move the page to archive after expiration [closed]
- .current-menu-item class on custom post type children pages – again?
- Run a function when post is deleted?
- Get posts by multiple ID’s (query)
- Exclude posts w/ specific post_meta on Rest API endpoint
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Admin Notices don’t display on the admin screen for certain post
- How to change wordpress dates to native language (even if the languge not available i wordpress)
- Theme removed “Edit Post” link on the front end. I wish it back
- WP_Query orderby not working with meta_value_num and menu_order
- Custom WP_Query with complex ‘post_status’ argument
- Saving category to a post, before publishing the post
- is there a way to show the the post title after the image?
- Add the description field on the attached media
- Is there a way to notify specific users when new posts are published to specific pages?
- get_adjacent_post by language
- Using ajax on editing a category edit page?
- Do action on publish or update?
- How to get posts and comments amount per hour, per year and per month?
- How to make only posts show date
- Get Post’s first image using Short-code
- Delete post results in “Cannot delete or update a parent row: a foreign key constraint fails”
- Change all author links in Blog roll
- How to I retrieve the ID from the Posts page?
- Let both the admin and post author update comment meta
- Modify posts listing at back end
- WordPress Query Posts From Category Post on Static Page
- How to allow multiple thumbnail upload for Posts?
- Loop through posts? Want to remove extra newlines in actual post HTML/content on backend
- add external project to web site wordpress on production
- Random posts that always include a particular post?
- How to remove text and retain in caption image using the_content function
- Show number of posts by logged in user
- How does WP decide how to display a page
- Cannot implement byline into posts container in single.php
- Insert data from custom created PHP page into wp_postmeta table
- Showing recent post of category in page
- Internal linking to posts permalink fail because of spaces and stripe at postname
- alternative to wp_link_pages() that only shows link to last page
- How to exclude the word “class” from being matched in search?
- Count user posts and store the number for later use
- Link to older links
- WordPress Excerpt Paragraph Limiting
- display jumps to the bottom, dosnt start at the top?
- How to determine if a post was last edited in the Visual Editor
- “Blog pages show at most” in setting not working
- My page shows some other content in WP
- WordPress get tags in “publish_post” hook
- What permissions does a role need for the user to be assigned as the author of a post?
- Countrywise Post View
- Scrollbar disappear in post window
- Add postmeta to all blog posts
- Enable HTML Tags in WordPress Post excerpt
- Checking if a post contains an html tag
- If taxonomy has more than 6 posts, display show all
- post->ID displays the same ID number for every post
- How to give priority to page than to posts permalink structure?
- Compare date of user’s last posts
- Only get post_id [duplicate]
- Disable `create_post` for built-in post type
- how to create other sizes of original image in one go wordpress uploads
- Post are not showing up
- Can’t seem to replicate permalink structure for localhost development site
- Newly created category does not show category
- Changing permalink of custom category
- Special Query: Title, Terms, Content – %LIKE%
- Authors can edit all posts, except when an owner is specified?
- WordPress Custom Theme: My site shows the same posts on Page 1 and Page 2 and so on [duplicate]
- Add News Feed to bespoke website, only to one page on whole site
- How to display my categories in a list (to a post, not the sidebar)?
- WordPress post enumeration
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields