Support

Account

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.