• Resolved TheElear

    (@peterpap)


    I wanted to have all my posts in all categories displayed in alphabetical order. In the child theme of my twenty ten I copied the category.php file and added the following piece of code (found on this forum) before the loop is called:
    $posts = query_posts($query_string . '&orderby=title&order=asc&posts_per_page=-1');

    It works like dream! All posts now are in alphabetical order.

    However one thing has changed – pagination of posts. So in a given category I can see now one long list of all category posts, rather than lets 10 and link to ‘Older Posts’ and ‘Newer posts’. These links simply disappeared.

    Any ideas how to alphabetize posts and keep the pagination?

    regards,
    Peter

Viewing 2 replies - 1 through 2 (of 2 total)
  • try and remove
    &posts_per_page=-1
    from the query.

    this part basically instructs the loop to: show all posts.

    Thread Starter TheElear

    (@peterpap)

    Thanks alchmyth. It works.

    I also found that ‘-1’ instructs to show all posts, but can be changed to whatever number of posts one wants to have displayed. So for example if I want to have 5 posts per page then the code will read:
    &posts_per_page=5. Navigation is then automatically added back.

    many thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Alphabetizing posts’ is closed to new replies.