To do this we will need to do 2 queries:
1) Get a list of all the users on the site via wp_user_query
2) Get posts from all the users using wp_query
The code:
$user_query = new WP_User_Query( 'Author' );
if ( ! empty( $user_query->results ) ) {
foreach ( $user_query->results as $user ) {
echo '<h2>' . $user->display_name . '</h2>';
$query1 = new WP_Query( 'posts_per_page=4&author_name=".$user->display_name );
while ( $query1->have_posts() ) {
$query1->the_post();
echo "<p><a href="'.get_permalink().'">'.get_the_title().'</a></p>';
}
wp_reset_postdata();
}
}
It’s not tested but it should display like:
Author 1:
– Post 1 Post 2 Post 3 Post 4
Author 2:
– Post 1 Post 2 Post 3 Post 4
Related Posts:
- Custom text box containing post titles
- Display recent posts with thumbnail within Masonry
- How do I use wp_get_recent_posts?
- Add Date to Recent Posts Widget?
- Recent Posts widget has some older posts at the top? [closed]
- how to show post content with post name in sidebar?
- Adding a badge to new blog post titles
- How to make slider show 4 recent news and news start from begining not from 4th
- Display recent post by tag
- Small intro before latest blog posts
- WordPress Recent post only showing title
- Recent post on single page from specyfic category
- How to display posts on template
- Help with “Recent Posts” Loop that is specific to a topic
- How to display last 3 posts (recent posts) in a static page?
- Multi user site and image captions
- Display list of most used tags in the last 30 days
- Author template, filter sidebar widgets by author?
- Multiple versions of RSS feed? One with full content, one with the excerpt
- Querying post from a multisite network
- Add inline HTML to posts published within last 24hrs
- Modifying recent post widget to include icons for post titles
- How to get post from all Blog Multisite to the Main Site?
- Related Posts loop – offset
- Show one post per author and limit query to 8 posts
- How to let a user choose an authors and save it to the database?
- How to target the default Recent Posts and Recent Comments widgets with pre_get_posts?
- Empty excerpt using wp_get_recent_posts
- Display Custom Post Type in Recent Posts
- Show recent published posts
- How to hide a post from ‘Recent Posts’ widget?
- customizing recent posts
- Display the date before the post title in recent posts widget
- How to display recent posts added in several custom post types
- How can I control multiple editing of wordpress posts?
- Multiple Authors on Single Post
- Grabbing specific content
- How to get most recent commented post above new submitted post in WordPress?
- Two posts are loaded instead of one?
- How to start with post number x?
- Use wp_get_recent_posts with search term
- Create static front-page with 3-5 recent posts
- the_excerpt not showing posts
- Where is the information about the authors for articles stored?
- recent posts for different categories
- Excluding a category from wp_query breaks recent post widget
- WordPress doesn’t show all posts of a specific author
- How do I exclude recent post from recent post php widget
- How to output only blockquotes content from recent posts in a widget?
- menu item to display the most recent post
- implement authentication and authorization to user
- Single-post preview repeats thumbnails in Jupiter Recent Posts widget
- Custom recent-posts shortcode’s thumbnail image not in line with rest of code
- How to get date of post when using wp_get_recent_posts()?
- Allow users to create post without logging in?
- link to single most recent post, regardless of category
- Most recent post is missing from Author page
- ‘Recent Posts’ links open in new window, without copying the ‘WP_Widget_Recent_Posts’ class
- Show recent posts starting at a specific number archive
- How do I get the content excerpt of the recent post?
- Recent posts on homepage: different thumbnail based on logged in status and post category
- How to Link to Most Recent Custom Post of Same Term
- widget_posts_args not using the number of posts in widget
- 2 column recent post query not respecting float right [closed]
- Sort / display recent posts by publish date
- List recent posts with link to first category
- Display recent posts on another site
- Why aren’t paragraphs breaking on this page?
- Get x recent posts by author?
- Recent Posts Listed by Author, Can I exclude authors?
- Showing recent post of category in page
- Manual excerpt length on recent posts slider
- How to add a recent post function to a text widget I created for practice?
- Offset Loop by 1 , Limit next loop to 1 (Most Recent) Post
- Show latest posts on responsive theme
- showing all recent posts in theme
- co-authors plugin – inline listing
- How do I add a small excerpt of a blog post on my Front Page Recent Posts widget?
- Editing HTML structure of Gutenberg layout recent post?
- Is there a way to display multiple authors on a post?
- date_query problem
- Best approach to allow front-end display of posts’ reviewers?
- Recent post in the middle of the content
- Recent posts show thumbnail
- Autoblog posts in wpms(network) into main site including featured images
- Paginate recent posts widget
- Multiple Author with link and image
- Have latest post and recent posts display differently
- How to redirect author subdomain pages to each author pages on www
- Show recent posts in single-post page
- Duplicate content with the same URL, google authorship
- Featured Image metabox (postimagediv) doesn’t appears when it should
- shortcode for recent custom type post
- Query recent posts by author
- Adjust layout most recent post, taking pagination into account
- Author Link in Recent Posts Widget
- Displaying warning if no featured image has been set – Post Editor
- Lists Top Authors by Most Recent Posts
- How to display recent posts on home page with title, post date, author and featured image?
- wordpress user profile page