How to get Total number of pages and posts . - WPTRINITY

How to get Total number of pages and posts .

For Getting Total Number of pages

function total_pages() {
	$total = wp_count_posts('page')->publish;
	echo 'Total Pages: ' . $total;
}
total_pages();

For Getting Total Number of posts,

function total_posts() {
	$total = wp_count_posts('post')->publish;
	echo 'Total Posts: ' . $total;
}
total_posts();