Hi there, I’m trying to find out if it’s possible to easily fetch (perhaps through pro your shortcodes) the counter of total published pages of a specific type. In this case, the post type I’m interested in is “waterfall”.
I have tried to generate several shortcodes through the looper consumer, but none returned the expected result. Therefore I had to write my own shortcode.
// Get post count for cpt
add_shortcode('postcount', 'post_count');
function post_count() {
$count_posts = wp_count_posts('waterfall');
$published_posts = $count_posts->publish;
return $published_posts . ' ';
}
I would like to achieve the same result through the built-in shortcodes.