Show the Complete Number of Listings

Share this resource

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on facebook
Submitted by: Donald McGuinn

This shortcode can show the number of listings on your entire website. This does NOT separate by listing type.

Use the shortcode [total_listings] in an Elementor shortcode element.

Put this code in your child theme functions.php file.

// Display the total number of published listings using the shortcode [total_listings]
function number_of_listings($atts) {
 return wp_count_posts('job_listing')->publish;
}
add_shortcode('total_listings', 'number_of_listings');