Home › Forums › Front-end Issues › Outputting count › Reply To: Outputting count
Hi @hs1972,
You can use WP_Query to get the total post. It should be something like this:
<?php
$args = array(
'posts_per_page' => 5,
'post_type' => 'product_custom_post_slug',
);
$myquery = new WP_Query($args);
echo "<h2>Found: $myquery->found_posts</h2>";
?>
To learn more about WP_Query, please take a look at this page: https://codex.wordpress.org/Class_Reference/WP_Query. If you have a further question about this, please ask WordPress forum.
Hope this helps.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.