Created
November 15, 2017 18:19
-
-
Save dartiss/ed919c82a01b80f31b0ad7bfd11c3192 to your computer and use it in GitHub Desktop.
Displays Number of Published WordPress Posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function post_count_sc( $paras = '', $content = '' ) { | |
return wp_count_posts() -> publish; | |
} | |
add_shortcode( 'post_count', 'post_count_sc' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.