Home Forums Weaver Xtreme Theme ASC sort order of post

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #17977
    manfred
    Participant

    ASC sort order of post does not seem to work correctly. My posts are on a page with posts template, and sorted by date with the ASC filter. First view on the excerpts is ok, but after viewing a post and returning to the previous view by clicking the breadcrumb or a category link, the sorting is messed up. The user has to open the page again, by clicking the menu. Sorting without the ASC filter works.

    #23100
    scrambler
    Moderator

    The sorting only applies to the page, once you click on a post you are in the wordpress loop, and I have no idea if you can control the order for next and previous there

    #23101
    manfred
    Participant

    Interesting. It’s clear you’re inside the loop when you’re looking at a post. But here is what I just tried out when viewing a post: If I click the browser’s back button, then the page with my category filtered posts are correctly sorted (ASC); if I get back on the category page by clicking the category name on the breadcrumb or the category link somewhere on the post, then the sorting is messed up. Does that mean that the back button gets me outside the loop, but the latter case does not?

    #23102
    scrambler
    Moderator

    Beware, that There is a default category page created by wordpress that you cannot edit.

    When you create a Page with posts that filters a specific category, this is a totally different page, that you can format using all the weaver Options for this page.

    So your page with posts allows you to sort things the way you want, but on the default WordPress category page, you get what WordPress decided. To change the default WordPress category page, you would have to create a Child theme, and edit the PHP templates.

    @Manfred, There is may be a way to make category links link to your custom category page instead of the WordPress default one. For the Category link in the post meta info line, if you have plus, you could create custom info lines that would have your own category page link. For the breadcrumbs, You would probably need a plugin, IF there is one that does that.

    @weaver, I was wondering if when people create their own category page using a page with posts, if there would be a way that this custom category page would be the one referenced in the default category links like breadcrumb or meta info lines. May be a filter could do that, or an option?

    #23103
    Weaver
    Keymaster

    Whenever you click an automatically generated category link anywhere (from a post meta line, the category widget, etc), you get the default WP category page. If there is a way to change that, it would be plugin territory. I don’t know if it is possible, but I don’t think it is a viable theme feature.

    #23104
    manfred
    Participant

    WP taking over after a click on the breadcrumb or on the meta line was a good tip. Because I couldn’t find a plugin which would handle the re-sorting, I now want to do something like <?php if (is_category()) { $posts = query_posts( $query_string . ‘&orderby=date&order=asc’)} ?>, but I don’t know exactly where to find the place to put that code. I know it’s somewhere inside the loop, but I’ve never tried to change the code in that area. Can someone help?

    #23105
    scrambler
    Moderator

    All PHP changes will need to be done in a child Theme , NEVER edit theme files!

    As for what to edit, you will be better off asking this question in the WordPress Forum.

    #23106
    Weaver
    Keymaster

    @manfred

    If I understand correctly what you want to do, you want to change what happens when a category set of posts is displayed.

    To do that, create a basic child theme. Copy the category.php file from the parent to the child’s directory, and edit that file with your altered query. I think it should be obvious given that you knew how to create that code snippet above.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.