I am new to php, please help. I am using this shortcode to show total number of published posts (400), it works fine. If I change ('post') to ('page') it shows total number of published pages (100) just as fine. I am trying to show total number of posts and pages (500) using one shortcode. Is it possible to add the two results and display as one total result?
function published_posts($atts) {
return wp_count_posts('post')->publish;
}
add_shortcode('posts_count', 'published_posts');