Custom Fields
Re-Envisioned
Support General How to get post number

  • Creator
    Topic
  • #27697
    Resolved Thibaut
    Participant

    Hello,

    I got 3 custom post types

    Books
    Photographers
    Publishers

    How to get the number of post included in each type? what the php function that will excecute?

    Thank you

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #27698
    Thibaut
    Participant

    found it

    <?php // Get total number of posts in "Books" post type
    $count_books = wp_count_posts('books');
    $total_books = $count_books->publish;
    echo $total_books . ' books. ';
    ?>

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.