How To Display All Posts Published By Particular Author?

It has become a pretty common scenario nowadays to create a WordPress website with multiple authors. These authors contribute a number of posts to the website. However, managing a multi-author site or a blog has its own set of challenges. Thankfully, WordPress offers a number of plugins that helps to efficiently manage a site having published posts contributed by multiple authors.

But, what if you need better control over the managing author posts from the administration dashboard? Put it simply, at times you may need to display some custom information or add extra functionality to your WordPress posts in the admin panel.

For example, you may wish to show all of the published posts of some particular author. In that case, finding a suitable plugin to accomplish this task from the sea of options, can make your head spin. In the worst case, you may not be able to find any such plugin. However, writing code can save you from going through the hassle of looking for the right plugin, and get the job done efficiently.

With this post, I will show a working example, to guide you how you can add a custom menu item, allowing you to display all the posts published by some particular author.

How to Display Published Posts By Particular Author Without Plugin?

Simply copy and paste the following code in your functions.php file:

OUTPUT:

output

The code goes through the below steps:

  • Add a menu in wp-admin area.
  • Fetch all the authors.
  • Add some style to list out the authors listing.

Now let us discuss about these steps one by one (i.e. understand how the code works):

Step 1

First, we are writing a code snippet that will add a menu in your website wp-admin area (this is only accessible to a user having administration capabilities):

The add_ action() function helps to embed additional sub-menus and menu options to the WordPress dashboard menu structure. In our case, the function add_action() is used to add extra menu option – Author Posts.

To be more specific, it creates a menu section in your website admin panel’s menu sidebar, by registering a hook “register_my_custom_menu_page” to the “add_menu” action. The hook is used to callback your function that will output the page content.

Step 2

Next, we are creating a function my_custom_menu_page(): which we have used as a parameter in add_menu_page function. This function will be responsible for displaying the content inside the menu.

Step 3

We have added some style code, so as to make look and feel of the contents displayed in the “Author Posts” page better.

That’s it! Hope reading this post will help prove a good starting point to help you better understand how you can manage your posts from your website admin panel easily.


About Author:

Ava Garcia is a passionate WordPress developer who likes sharing her knowledge about latest advancements in the world of web development. If you’ve been looking to hire WordPress developers for your upcoming WordPress website development project, then Ava can prove to be one of your best bets.

Tags:

You may also like

Free Brush Font: Leafy

Leafy is a handwritten brush font. It features 95 characters and has all the basic glyphs. The download contains a .otf file.

Jan 25, 2017 6:35 AM