• Resolved ginntonic

    (@ginntonic)


    I need to pull the published post number for a category, e.g.:

    No. (this number, in reverse chronological order, e.g.) 34
    THE TITLE

    No. 33
    THE PRIOR TITLE

    No. 32
    THE TITLE BEFORE THAT… &c.

    Thanks!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • This will list posts for Category=1, in reverse Post ID order (highest post ID to lowest post ID):

    <?php
    $posts=get_posts('cat=1&showposts=-1&orderby=ID&order=DESC');
    if ($posts) {
    foreach($posts as $post) {
    setup_postdata($post);
    ?>
     No. <?php the_ID();?> 
    
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    
    <?php }
    }
    ?>

    If you want the posts order by date delete the orderby and order clauses.

    Thread Starter ginntonic

    (@ginntonic)

    Thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pull published post number, NOT total’ is closed to new replies.