Forums

How to move "Expired posts" to the end of the loop? (3 posts)

  1. Ionut
    Member
    Posted 2 years ago #

    When a post is published into a category, lets say http://www.adoptiicaini.ro/cat/bucuresti/ the post appears first in the loop, but after the post is modified and added to another specific category (named Expired) I want the post to be moved to the end of the loop.

    It's like sorting posts by category, but all I want is to move to the and all posts that has the category Expired checked. This have to work every time, for all categories alphabetically after or before Expired.

    I don't want to exclude them like this:
    http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category
    because the categories might end up empty at some point. Instead I want them to remain in the category loop so that, in this way, people from Google don't get 404 errors saying page 3 of the category does not exist anymore.

    I need to do this for a website with dogs for adoption ( http://www.adoptiicaini.ro/ ) , so anybody who loves dogs please give this a look :)

    Thank You!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try using query_posts to exclude that category in the main Loop and then run a second Loop that just displays the Expired category posts.

    http://codex.wordpress.org/The_Loop#Multiple_Loops

  3. Ionut
    Member
    Posted 2 years ago #

    I don't know how to create the second loop too keep the pagination flowing and the posts both in Expired category and the curent category, not just Expired ones from all categories. I don't think it's possible with query_posts... To exclude the expired category I use Advanced Category Excluder but that's all.

Topic Closed

This topic has been closed to new replies.

About this Topic