• OK…

    So I have post which and one its page somewhere I want it so show>

    1. The number of posts in that category
    2. the number of that particular post.

    So for example I’d have a post:

    10 Great Things about Christmas
    And below the title it will show 3/45. Where 45 is the number of posts under the Christmas category and 3 is the third latest post under Christmas.

    So the latest post would be 1 and the very first post under Christmas would be 45!

    I hope this makes sense.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter aminabbasian

    (@aminabbasian)

    I’ve managed to put this together:

    <?php $category = get_the_category(); echo $category[0]->category_count;?>

    Which shows the number of posts in a category but I haven’t been able to find how to make it show that this is post 3 of 45 in the Christmas Category.

    Is this even possible?

    Thread Starter aminabbasian

    (@aminabbasian)

    anyone with any ideas on this? I’m on the brink of giving up!! ??

    Thread Starter aminabbasian

    (@aminabbasian)

    OK not giving up.

    I’ve looked at some pagination I’m not sure that’s the way to go but I have found this:

    <?php $count = 1 ?>
    <?php $currentpost = get_the_ID(); ?>
    <?php $my_query = new WP_Query(array( 'your-taxonomy' => 'specific taxonomy', 'posts_per_page' => 8 ));
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <li class="page-numbers"
    <?php if($currentpost == $post->ID)
    {
    echo ' id="current" ';
    }
    ?>><a href="<?php the_permalink(); ?>"><?php echo $count; ?></a></li>
    <?php $count = $count + 1 ?>
    <?php endwhile; ?>

    This displays 8 posts of ALL the categories.

    What needs to be changed so that it shows the first and last post of the category which the post belongs to?

    So I’d like to show < 1 / 45 > for the first post in the category and < 20 / 45 > for the twentieth.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show number of posts in Cat and the number of post…’ is closed to new replies.