• Here’s something that must be really easy, but I can’t understand the PHP needed to do it. I want to list all my posts (headline only) in chron order with the oldest first and a little header that identifies what number post it is…

    Exactly like this:
    http://www.matternetwork.com/paul-herman-hip-investor.cfm

    So I figure I’ll make a tag, call it “apples”, then make a custom tag pag called “tag-apples.php” ..

    The hard part is how do i get it to go in reverse order and how can I add cleaver numbering to the posts?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • I want to list all my posts (headline only) in chron order with the oldest first and a little header that identifies what number post it is…

    make a tag, call it “apples”, then make a custom tag pag called “tag-apples.php” ..

    – does that mean you want only all posts with the tag ‘apples’ in that list?

    get it to go in reverse order

    http://codex.wordpress.org/Function_Reference/query_posts#Usage_Note

    – ideas to numbering:
    possibly with the use of a counter variable and for the output a function like this:
    http://www.php.net/manual/en/function.number-format.php#89655

    you could use the http://pastebin.com/ to share whatever code you have so far…

    Thread Starter nickaster

    (@nickaster)

    Bam, thanks a lot. I solved the number problem pretty simply… just used an ordered list!

    But man, this php is killing me. It’s chicken or the egg on understanding how it works. That page you linked too shows all this “query_posts” stuff, but my code is much simpler, doesn’t have any of that. This is the only relevant part:

    <ol><?php while (have_posts()) : the_post(); ?>
    		<li><h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4></li>
    		<?php endwhile; ?>
    </ol>

    Works great except for the order which I want to reverse….

    following this link http://codex.wordpress.org/Function_Reference/query_posts#Usage_Note, insert the ‘query_posts’ stuff before the loop:

    <ol><?php global $query_string; query_posts($query_string . '&order=ASC'); while (have_posts()) : the_post(); ?>
    		<li><h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4></li>
    		<?php endwhile; ?>
    </ol>

    it kind of says: use the existing query, but add the ‘order’ parameter and set it to ‘ASC’

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Really basic "loop" PHP question…’ is closed to new replies.