Approximate time to read: <1 minute
Needing to provide information for a page for marketing companies, I created a shortcode that would output the number of posts that have been published. And it’s just 2 lines long!
Copy the code below into your theme’s
functions.php file and then place the shortcode
[post_count] wherever you wish the count of posts to appear.
If you want to change the shortcode name, simply change it on the final line.
Short, sweet and does the job!