Search
Close this search box.

How to Show Author Total Posts in Divi

Most of the themes don’t have the total number of posts published by the author displayed on the author archive pages. So, if you’re using WordPress default editor and you want to show it on your author archive page but don’t want to install an additional plugin, you may need to manually edit the author page, which requires you to have some knowledge of PHP and HTML.

Furthermore, you may need to create the author.php file yourself in your theme folder if your theme doesn’t have the file. Then after creating the file, you still need to add your custom code or you can copy the archive.php file content and make adjustments as you need. Below is a simple example of a custom author archive page with the author’s total posts using the Twenty Twenty-One theme.

However, if you’re using a page builder like Divi to build your website, you just need to create a custom author archive template using the Divi Builder and then add the dynamic total author posts anywhere on the template like follows.

This tutorial will show you how to add a dynamic total of posts by an author on the author archive page that will change according to the number of author’s published posts. And if you want to, you also can display the total number of posts on any page of your choice by using the shortcode that we will create later in this tutorial.

How to Show Total Posts by an Author

Before you start, you may want to back up your site or use a child theme to avoid breaking the parent theme or losing your changes when you update your theme since you’ll need to add a custom code to the theme functions.php file.

If you don’t mind adding one plugin to safely add custom code to your WordPress theme, you can use the Code Snippets plugin as it is an easier and faster way to add and manage custom codes.

Get the Shortcode Ready

Once you’re ready, add the following codes to the functions.php file by navigating to Appearance Theme File Editor ( ToolsTheme File Editor if you’re using a block theme) from your WordPress dashboard and select the file from the Theme Files list.

//start of author total post
function wpp_authortotalpost(){
	$post_count = get_the_author_posts();
	return $post_count;
}
add_shortcode('authpost','wpp_authortotalpost');

Once you’ve placed the code, apply your changes by clicking on the Update File button.

Now, whenever you place [authpost] shortcode to your page or post it will show the number of the total published posts made by the current author.

Displaying Total Author’s Posts in Divi

To display the author total post on your author archive page in Divi, you need to create a template for it first by using the Divi Theme Builder. And to create one, you can read our article about creating a custom author archive page with Divi here.

Once you’re ready to add the total author post on the template you’ve created, you just need to add the [authpost] shortcode to the module you’ve prepared. For example, we’ve added the shortcode to a text module and shown the total post in a sentence like follows:

And once we’ve saved the template, the result from the front end is like follows:

The above picture shows a screenshot of an author’s archive page with the total published posts just beside the author’s bio.

The Bottom Line

If you’re using WordPress default editor and you want to show the author’s total posts on your author archive page but don’t want to install an additional plugin, you may need to create the author.php file yourself. Moreover, you still need to add your custom code to display the author name, avatar, profile, and published posts. That’s not the case if you’re using a page builder like Divi. With Divi, you just need to create a shortcode and display the total number of posts on any page of your choice.

This page may contain affiliate links, which help support our project. Read our affiliate disclosure.
Picture of Hendri Risman

Hendri Risman

Hendri is a WordPress expert and a writer staff at WPPagebuilders. He writes solutions on how to get things fixed in WordPress a lot. Mostly without involving a plugin.
Want to turn your WordPress knowledge into revenue? OF COURSE!

Leave a Comment

Share This
Save your Divi assets to the cloud and access them from anywhere.
Hey 👋🏻
Do you have a WP blog?
If so, you may need these. All the resources you need to grow your blog.

Your popup content goes here

50%

Where should we send the template?

After entering your email address, you will be added to our newsletter subscribers. You can unsubscribe anytime.

Want to Build Passive Income Like the One on the Screenshot Below?

Click the button on the right side to learn how 👉🏻
5 easy steps to turn your WordPress knowledge into monthly recurring revenue.

Click the above button to close the popup.