Display Multiple Authors In WordPress

Ever required or needed to know how to show in excess of one creator’s posts on a WordPress blog, for example, the landing page? On account of the numerous capacities inside WordPress this is very simple to do and requires just a couple of lines of code.

With a specific end goal to indicate in excess of one creator we will utilize the query_posts() work. With the goal for this to work accurately you have to put the code before the start of the code that begins The Loop. An illustration query_posts() fucntion would look something like the accompanying.

In the above code you can see the factors that we set within the bracket and inside single statements; author_name and showposts. The author_name variable is the username for the creator that you are needing to show, not the first or last name (the username can be not quite the same as the show name). The showposts variable just sets what number of presents you might want on have shown. Entirely straightforward right? The main thing left now is to include the code used to check if there are posts, the code to show the post’s data and afterward shut the circle itself.

The above code will enable you to utilize numerous circles on your WordPress blog with a specific end goal to show the same number of creator’s posts as you might want. All that you need to do is change the author_name variable to whatever creator you might want to appear.

Gives up ahead and work out an example bit of code that would list 2 unique creators.

There you have it, the above code will show the most recent 5 posts from the creator with the username of administrator and after that show the most recent 5 posts from the creator with the username of bobo. You can utilize IDs for each creator’s presents all together on give each creator’s substance their own custom look.

Releated Post