CPT Pagination number out of amount, e.g 1/10, 2/10 etc?

WordPress 3 posts 2 voices

  1. Is it possible to echo/display what number of post your’ve currently on combined with the pagination order of the posts?


    Project Name - 1/10 - (Next Project)

    (Previous Project) Project Name - 2/10 - (Next Project)

    However, the numbered aspect respected the order of the query e/g..

    $args = array(
    								'post_type' => 'works',
    								'orderby' => 'menu_order',
    								'order'     => 'ASC',
    								'showposts' => -1
  2. On multi-post pages, such as archives, WP has this number. However, it doesn’t have this number on singular views.

    Using menu_order, you could possibly do it if your menu_order was 1, 2, 3, 4, etc. Or, you could store that as a custom field. That’d be for the individual post’s number.

    The most efficient method of getting the total number of posts is to use the wp_count_posts() function: https://developer.wordpress.org/reference/functions/wp_count_posts/