How to add Post counts in archive page without plugin

Post count

Welcome to this informative video where we dive into the world of WordPress development! In this tutorial, we’ll explore a powerful shortcode that will revolutionize how you display the number of posts or articles each author has, all while incorporating a customizable post type.

Shortcode that i created!

Add this short code in your theme or child theme’s functions.php file

<?php
// post numbers by author ID
add_shortcode('eco_pc', 'p_c_function');
function p_c_function(){ 

	$user = get_the_author_meta( 'ID' ); 
	printf( __( 'user post numbers: %s', 'eco' ),  count_user_posts( $user , "post"  ) );
								  						
}
?>

Add in Bottom of your Functions.php

Gone are the days of manually counting posts or relying on complicated plugins. With the shortcode we’ve created, you can effortlessly showcase the post count for each author, whether it’s for a blog, news site, or any other content-driven platform. The best part? It’s all tailored to your unique needs!

Through this step-by-step guide, we’ll walk you through the process of setting up and implementing this shortcode. No prior coding knowledge is required – we’ve got you covered! We’ll cover the basics of shortcodes, explain how they work, and then show you how to customize it to your desired specifications.

By the end of this video, you’ll have a shortcode at your disposal that not only displays the number of posts per author but also allows you to select a custom post type. This flexibility opens up a world of possibilities, enabling you to track the author’s contribution across different sections of your website.

Join us as we explore the inner workings of this shortcode, uncovering the logic behind it and demonstrating real-life examples of its application. We’ll provide clear explanations, practical demonstrations, and troubleshooting tips to ensure your success.

Whether you’re a beginner looking to expand your WordPress knowledge or an experienced developer seeking to streamline your workflow, this video is for you. Enhance your website’s functionality, save time, and impress your audience with the dynamic post count display powered by our innovative shortcode.

So, if you’re ready to take your WordPress development skills to new heights, hit that play button and let’s dive right in! Get ready to create a visually appealing and data-driven user experience with our game-changing shortcode. Watch, learn, and empower yourself with the ability to showcase author post counts in a whole new way!

More Articles