• I’m using the Simple Tagging plugin and am trying to alphabetize tag search results: the posts that are displayed when a tag is clicked.

    I put the pagetemplate.simpletagging.php file in the root folder of my theme, and in the Simple Tagging settings, used that for the ‘search results template file.’ The template works fine, and I get all the posts for that tag displayed, until I change the loop to this piece of code, which I thought should alphabetize the results:

    <?php $posts = query_posts($query_string .
     '&orderby=title&order=asc&posts_per_page=-1');
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    When this code is used, no posts are shown for tag results at all, however I do get the “Sorry Not Found” display from my template instead.

    But, if I use that same loop code on the Main Index Template (rather than a separate template), I can get alphabetized tag results, but of course I get them on the front page as well. I want the front page to display chronologically, or maybe a ‘front page’ category. (I’m using both categories and tags, but only having problems alphabetizing the tag results.)

    It’s not unlikely my problem stems from not understanding something fundamental about the loop or querying posts. I would very much appreciate any help from anyone with more experience and hope someone has an answer or work-around.

    blog in question: https://www.vintagevinylrevival.com/records/

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter 78speed

    (@78speed)

    Or maybe I’m not understanding how templates work, or how the Simple Tagging plugin uses a template. Should I have posted this under ‘Themes and Templates’ ? Any help would go a long way, thanks.

    Thread Starter 78speed

    (@78speed)

    Thanks anyway. In case anyone else has a similar problem (though certainly this is not the best answer), being the amateur hack that I am, for now I’m using this work-around:

    I chose to use a static page for my front page and created a template for that page. In the template I used the code
    <?php> query_posts("cat=1"); ?>

    to call posts from a certain category, in this case the “current picks” category. I’m avoiding using a pagetemplate.simpletagging.php or tags.php file to display the tag results, as I can’t figure out how to get the posts alphabetized, as described above. Instead, I’m using the Main Index Template to customize the tag results display, as I can only get the customized loop to work here for some reason.

    In this way, my rookie pea-brain is able to have chronological ‘front page’ posts, and have alphabetized archives for each tag and category.

    whoopee!

    Thread Starter 78speed

    (@78speed)

    bump, bump, nudge nudge – here I go talking to myself again.

    This apparently is a bad solution – as now my < more > link won’t work, since apparently it doesn’t normally work on a template file.

    I’ve searched the forum and support, and have not found a clear answer to how to get the < read more > link to somehow work for a page template. And I still don’t know why I couldn’t alphabetize posts.

    Does anyone see what’s going on here? Is my problem at least clear? Please help, this problem is puting a big snag in my web dev. Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Alphabetizing Simple Tagging Search Results – Problem with Loop in Template’ is closed to new replies.