Ready to get started?Download WordPress


sorting posts (4 posts)

  1. lucir
    Posted 2 years ago #

    I have a template that displays posts of a certain category. I want the posts to appear not in chronologic order, but in numeric order like Lesson 1, Lesson 2, Lesson 3, etc. I inserted the code:
    <?php global $query_string; query_posts($query_string . "&orderby=title&order=asc"); ?>
    in the template which works but only up to Lesson 9. Lesson 10 is placed before Lesson 2 because it sees the digit 1 in 10 as coming before 2. This is a problem ... I could rename the posts like Lesson A, Lesson B, Lesson C, etc, but I would rather not. Any suggestions?
    I would appreciate any ideas.
    Thank you

  2. Colin Murphy
    Posted 2 years ago #

    What about ordering post by date and then orderby asc assuming that the first post you posted was Lesson 1 through to 10 ...

  3. lucir
    Posted 2 years ago #

    Yes that would work but If I want to update a post and repost it it would have the wrong sequence.

  4. lucir
    Posted 2 years ago #

    Thank you, Colin, you gave me an idea. It's not my preferred solution, but it would do for now. I don't need to delete a post to update it, simply remove it's Flash content, update it, and replace it.

Topic Closed

This topic has been closed to new replies.

About this Topic