Ready to get started?Download WordPress


[resolved] Alphabetizing Posts in a category template (2 posts)

  1. sophiavancouver
    Posted 7 years ago #

    What I'm trying to do is have an alphabetical list of resources in a particular category. I have a category archive template that lists the posts, title only, as I want, but I can't get it to alphabetize the post titles.

    I have been backwards and forwards over the 'alphabetizing posts' codex entry but it doesn't work for me.

    The loop in my template is split into two sections. The 'if statement' is at the top, then some coding around category title insertion and formatting, then the 'while' portion of the loop begins. I have attempted to insert the following code code <?php if (is_category()) { $posts = query_posts($query_string . '&orderby=title&order=asc'); } ?> `
    just before the 'if statement' of the loop (after the <?php and before the 'if' ) and the sort doesn't change. (I remove the php opening and closing tags if it is going inside another php statement) I have also inserted it with and without it's own <?php opening and closing tags in various places within the loop.

    Could there be an issue about the fact that I'm displaying the post titles only?

    I've run out of leads. I've tried the WP-snap plugin, but I really need to show all the post titles, not just those beginning with a particular letter.

    The thing that really mystifies me is that I thought it worked (now I'm doubting that...) when I first set it up, and then stopped working, but I didn't modify this category template in the interim. I may have added some plugins in the interim, but that'd be it. What could interfere with sorting posts in a category? I'm going to go through and systematically deactivate plugins, and test, but other than that I'm stumped.

  2. sophiavancouver
    Posted 7 years ago #

    I figured it out - it was WP-Sticky making all the problem! when I deactivated it, my alphabetization worked again. jeepers!

Topic Closed

This topic has been closed to new replies.

About this Topic