Blog Post Sorting – descending

Community Forums Forums Design Tips and Tricks Blog Post Sorting – descending

This topic is: resolved

This topic contains 6 replies, has 2 voices, and was last updated by  csbeck 1 year, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #29914

    csbeck
    Participant
    Post count: 135

    I’m using Metro theme. I have a page that uses the Blog template that lists Posts from a particular category. This page (a listing of events) needs to be shown in descending order of the events. So that the most recent added event goes on the bottom of the list. I only want this functionality on this page (and pages like it that show dated events). I want the Blog listing page to show in correct Ascending order to show the most recent blog post on the top.

    Here’s the page: http://www.julieberrybooks.com/events

    Is there a way to do this? I tried looking up a plugin (WP Post Sorting) but it’s not recently updated or supported in the latest WP version. I know I could always change the date that a post is created, but is there a way to sort posts on a per-page basis? It seems like there should be since I am able to list only a certain category of posts on a blog page (using custom fields – query_args). There’s got to be a way to do this.

    I would appreciate any assistance!

    #29952

    Robin
    Participant
    Post count: 318

    How are you creating this page? Are you using query_args as a custom field? If you are, then you should be able to do this with the value. I’ve set one up with value “cat=7,8,9&orderby=title&order=ASC” for a client to pull those categories and order them by title alphabetically.

    So, theoretically, you could do “cat=x&orderby=date&order=DESC” (or ASC if that makes it work correctly) in addition.


    I do the best I can with what I’ve got. (say hey on twitter)

    #29954

    csbeck
    Participant
    Post count: 135

    You absolutely rock! I guess I was scared to try that. Thanks so much. Works like a charm!

    #30302

    Robin
    Participant
    Post count: 318

    I adore query_args. Glad I could help!


    I do the best I can with what I’ve got. (say hey on twitter)

    #46405

    csbeck
    Participant
    Post count: 135

    Do you know if there’s a way to add custom fields to the query argument. I’ve tried a few things and it’s not working.

    I thought I’d try:

    `cat=2&orderby=meta_value&order=ASC`

    But that didn’t work.

    What I have is a custom field with a key of “last_name” and posts have different values with respect to the last name of people (there’s a collection of people in a people category, the post title is a name – First Middle Last). So the custom field with the person’s last name is in there so I could list these people on a blog listing page but I want to sort them by their last name.

    Or would it be better if I just created a custom Blog Listing page and created a custom loop?

    Any thoughts?

    #46785

    Robin
    Participant
    Post count: 318

    I have a similar situation. What I did was change the slug on each person’s entry to be their last name and let the query args sort by the slug. The full query args reads:
    `post_type=missionaries&orderby=name&order=ASC&nopaging=true`
    (It’s a custom post type and I wanted it to show them all on one page–that’s the extra code. But the relevant part is the orderby=name.) HTH


    I do the best I can with what I’ve got. (say hey on twitter)

    #46787

    csbeck
    Participant
    Post count: 135

    Thanks Robin.

    I also started a new post with this similar subject – http://www.studiopress.com/forums/topic/using-query_args-with-custom-fields/

    Hopefully this will help anyone else with this challenge.

    Chris

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.