You can get the latest post of an author adding the following code to your function:
$latest_post = get_posts( array(
'author' => $id,
'orderby' => 'date',
'numberposts' => 1
));
// Since get_posts() returns an array, but we know we only
// need one element, let's just get the element we need.
$latest_post = $latest_post[0];
Then modify your $output
, adding the data you need (specifically guid
for the permalink, and post_title
for the title), for example:
$output .= "<div id='bloggers_latest_post'>
<a href="https://wordpress.stackexchange.com/questions/95004/$latest_post->guid">$latest_post->post_title</a>
</div>"
Related Posts:
- How to display posts by current user/author in a custom page template?
- Get x recent posts by author?
- How to get single post by one author?
- How to show related posts by category
- Hook that get’s triggered when the author of a post is changed
- get all posts ID from a category
- WordPress: How to get the current logged in author page URL?
- How to add editor’s name to entry meta byline?
- Get the user type of an author
- Setting pagination for images attached to a post
- Find most recent authors
- Query only Posts from Both of Two Category?
- Filter posts by author and category simultaneously
- WordPress get posts by date without query_posts
- Get all posts by post_author
- Authors in menu, template list post by author
- Posts are not showing up on particular category
- get selected post using $_GET
- setup_postdata doesn`t seem ot be working
- Get Posts via Taxonomy Term Name with Space
- Show info to author only
- get_next_post() and get_previous_post() return wrong posts
- Auto “expire” all of an authors posts on spcific date
- How to get the user meta data for a post?
- Get posts by name and taxonomy term
- Inserting custom data to the_post() during loop
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- Limit popular posts by days
- get_the_content(“more…”) returns full text
- Whitelist Author of Private Post
- Show posts by a custom post author
- Post Loop Missing Most Recent Post
- Include sticky posts on the static page front page
- Get attachments for posts that belongs to a specific category
- Display Notification Bar on Header on Certain Post Count
- How to get posts from a current post’s month?
- How do I retrieve a users’ last 5 posts?
- obtain the author id given the post id
- While loop articles – if statement order
- Count number of posts of current month
- static landing page leading to author specific pages w/ “live” content
- Display Posts with template on a Page
- Why posts array is empty?
- All Posts Linking to Author Posts directly
- How to create a “latest news” page showing a list of posts from blog category
- Post Filtering by GET URL parameters
- How to get the ability to change the author of a post
- Echo Text If User Is Logged in But NOT the Author of post
- Only allow posts with a specific term to only be viewed by other authors with the same term in their post
- Related Posts function not working
- How to limit author related post listing ?
- Get total post from an author
- Exclude a category of posts in author template
- Get latest author posts inside the loop
- If post does not exist, do something
- Internal linking to posts permalink fail because of spaces and stripe at postname
- Authors’ Links on Homepage Not Going to Author Post Pages
- Get posts from current category?
- Send email to admin with post author
- adding my posts (author posts) in menu
- How to show multiple posts thumbnail, title and date in widget
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- Show only posts with titles/permalinks that do not contain certain words
- How to merge the content of posts that have the same title?
- How to add first 3-4 post tags on WordPress Post Title
- Restricting displayed posts to posts from only select authors
- Change of author not updating
- Limit Post Creation Count by Author or Role
- How to mark only one post as Featured post?
- What permissions does a role need for the user to be assigned as the author of a post?
- get_next_post() not working with future post status
- Extracting the permalink from a post instance
- Posts page listing pages as well
- How to Get Position of a Post from a category and tag
- Custom author search
- How to get all posts in gallery post format template
- Changing the Category for all posts of an Author
- List of authors posts minus very latest
- How to get the current user post and it’s ID?
- show latest authors blog post
- Getting posts from multiple users?
- Retrieve latest post by multiple categories with ID
- Display the current post author and his url in the post header
- External link not showing on post but showing on comment
- Create a Page Template Which Displays All Posts by Current User
- Set the limit to allow author when make post!
- Show last post of employee in his profile page
- Load posts from external source if not found in database
- Notify Author of the post if admin deletes his post and perform some function
- get_posts includes “auto drafts”?
- how to show all type of author posts in author page (SOLVED)
- How to show total view count across all posts for an author
- How can I add Author’s phone number to wp profile and make it appear in wp-admin/edit.php columns
- Add author section on Author archive posts
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- How to make the Post Author name fixed as “Editorial Staff” even if there are multiple authors?
- View post with specific category id and name which I selected in the backend (drop-down option)
- users followin the blog post author
- Translation related post text to Arabic