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?
- Users with custom roles not showing in post author select box
- Code for Recent Posts Widget
- Multi user site and image captions
- Schedule Posts to Publish from Dates/Times Pre-Set by Admin
- Display list of most used tags in the last 30 days
- Author template, filter sidebar widgets by author?
- Set up collaborative site
- Shared functions.php across multiple WordPress websites
- Multiple versions of RSS feed? One with full content, one with the excerpt
- Modify recent post sidebar to show post thumbs with out plugins
- Querying post from a multisite network
- Display all comments or recent comments per user on author page
- Add inline HTML to posts published within last 24hrs
- Modifying recent post widget to include icons for post titles
- Adding An Author Tag To Posts Automatically
- Add thumbnail to recent posts widget using filters
- How to get post from all Blog Multisite to the Main Site?
- How to exclude categories from recent posts, recent comments & category widgets?
- meta_query not working properly
- Unable to show recent custom post types in default recent posts widget
- 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?
- Edit/revise option for authors to suggest improvement to posts [closed]
- 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
- If numberposts = -1 offset won’t work
- Display the date before the post title in recent posts widget
- How to display recent posts added in several custom post types
- Order posts by meta value and Date
- How can I control multiple editing of wordpress posts?
- What’s the difference between “get_posts” and “wp_get_recent_posts” when used with “setup_postdata”?
- Google Authorship on a multi-author blog?
- How can I show recent posts from same taxonomy as the post currently being viewed?
- How to display recent / random posts by its category
- Multiple Authors on Single Post
- How to query posts from specific authors and categories using WP_query?
- Publish article only if approved by 2 or more authorised author
- Remove Author Slug & Replace With Username
- Grabbing specific content
- How to get most recent commented post above new submitted post in WordPress?
- Two posts are loaded instead of one?
- Recent Posts widget without Title
- Change recent posts widget title
- How to start with post number x?
- update_user_meta add value on the top on existing value
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- Use wp_get_recent_posts with search term
- Create static front-page with 3-5 recent posts
- Display most recent post on homepage?
- the_excerpt not showing posts
- How to truncate titles in Recent Posts widget?
- Customizing wordpress default widgets?
- Recent posts with featured image or fallback image with permalink
- Where is the information about the authors for articles stored?
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- recent posts for different categories
- Excluding a category from wp_query breaks recent post widget
- How do I add recent posts to the menu?
- WP Bakery Load More Button loads the same posts
- 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
- Can multiple authors be assigned on a single custom post?
- Single-post preview repeats thumbnails in Jupiter Recent Posts widget
- WP_Query with offset and ‘orderby’ => ‘rand’, offset not working
- 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()?
- Proper way to display latest 5 posts grouped by post type?
- How to add an inline word after post author commenter name?
- Reset WordPress Post Query to default
- Author list based on recently active
- How to get excerpt of the recent posts
- Allow users to create post without logging in?
- List most recently added posts (with a twist)
- Recent posts on homepage
- link to single most recent post, regardless of category
- Most recent post is missing from Author page
- How to obtain the recent posts without their content in an efficient way?