Home Forums Weaver Xtreme Theme Sorting posts – Link to Same Categories

Viewing 16 posts - 1 through 16 (of 18 total)
  • Author
    Posts
  • #68051
    dosolutions
    Participant

    Is it possible to sort the links (next – prev) in the Link to Same Categories option?

    Thanks

    #68052
    scrambler
    Moderator

    Not that I know of, this is a WordPress thing, you may want to search on WordPress.org in case there is a PHP method

    #68053
    dosolutions
    Participant

    There are a couple, just searched for sort posts within categories.

    Thanks for the tip.

    -Daniel

    #68054
    scrambler
    Moderator

    @dosolutions Remember that if you change PHP files, you need to do that in a child theme.

    And if it works, post back here how you did it, as this is a request that has come before

    #68055
    dosolutions
    Participant

    The problem with the plugins i have found is that they only allow manual drag and drop sorting, not alpha sort.

    It appears there is a way to do this in the category.php file;

    <?php if (is_category()) { $posts = query_posts($query_string . ‘&orderby=title&order=asc’); } ?>

    But I am not sure where to add this code or how might be best…

    Alternatively in the functions.php

    function foo_modify_query_order( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'orderby', 'title' );
            $query->set( 'order', 'ASC' );
        }
    }
    add_action( 'pre_get_posts', 'foo_modify_query_order' );
    
    Again, without modifying the respective files, I am not sure how to proceed.
    -Daniel
    #68057
    Weaver
    Keymaster

    Have you tried the Page with Posts page template? I think if you specify a category to ahow, then the prev-next will link to the previous/next post in the category. And the sort options will work as weill.

    #68075
    dosolutions
    Participant

    The page with post template? i that for posts or only pages?

    Also the previous and next links do not show all posts in a category, and in fact show more posts in the next direction then in the previous direction. Is it possible that posts with multiple categories are some how exluded or other logic is at work to hide some posts?

    Thanks

    #68077
    scrambler
    Moderator

    What page are you starting from, a blog page, a single post page, and archive category page …..

    #68078
    dosolutions
    Participant

    rep-solutions dot com

    The posts are included on pages in groups (by category) with a plugin called flex blocks.

    Each post is an item, clicking on the item brings up that post. So it is “a page with posts” at first then just a single post.

    The navigation on a single post is not consistent, in the next direction, there are more posts then in the previous direction, and the only thing i can think up is that any posts that have more than one category are somehow being excluded.

    #68080
    scrambler
    Moderator

    the home page does not have any post, you need to be specific.

    But from what you are describing, you are speaking of previous – next post navigation form a single post page.

    Once you are on a single post page, there is no way for the page to know that you want to navigate a single post category…..

    #68084
    Weaver
    Keymaster

    There is a global setting for single page post views:

    Single Page navigation links point to posts with same categories

    This is on the Customizer -> Layout -> Post Specific ,  Post Navigation section

    That is a global option, so once set, all Single Page views from posts of any category will have links to other posts in the same category. (I’m not sure what happens if a post is in multiple categories.)

    This option has been in Weaver Xtreme for some time (free version), and frankly,  I can’t remember every option. This one is probably not used that much.

     

    #68085
    scrambler
    Moderator

    I never even knew about that one 🙂

    I do remember people asking about it, so I guess at one point you must have decided to add the option

    #68086
    dosolutions
    Participant

    Nav Links to Same Categories ↻ Single Page navigation links point to posts with same categories – is checked.

    The problem is they are not alpha sorted, and there are fewer posts items than actually exist in the category! I think later issue is a bug.

    -Daniel

    #68087
    dosolutions
    Participant

    Something similar to this code link… may work, but i have no idea how to implement it.

    wordpress dot org/support/topic/display-by-category-homephp-template/

    #68088
    scrambler
    Moderator

    It looks like your link describes a page with posts by category which the theme page with posts already does.

    For the “Nav Links to Same Categories” issue can you elaborate /test on the following.

    When you navigate from a single post page do you only get posts from the same category?

    If you say yes but are missing some of them, can you confirm if these indeed have more than one category?

    To verify, create a test post with just that category, and see if it gets included in the navigation.

    Then create another test post and give it two category (including the one you are testing), and see if that gets included in the Navigation from a post in the testing category.

    But I have tested with posts that have more than one category, and it works for me. SO you are going to need to look at what exactly is different on the posts that do not show up.

    Eventually tell us what category is not fully working and give us a link to the the single post page of one of them, so we can test the navigation

    As for sorting, I would assume the sorting is by date as this is the WP default, but check and confirm.

     

    #68089
    Weaver
    Keymaster

    I don’t know exactly what you are doing, but I’ve just done some substantial testing on my test site of the Nav Links to Same Categories option. It is working exactly as described and designed for me.

    I have more than 100 posts, all with a category assigned, some with more that one category.

    I can start with essentially any blog-like page that displays posts. I tried two different tests:

    1. I opened a any random post in Single view. If I then click next or previous post, the next or previous post (by date) with the same first category (if more than one category assigned) shown will be displayed.  Continued previous/next clicking will show more posts with that same first category. The posts are displayed in date order – older on the previous, newer on the next.
    2. I open a show by category archive-like page which shows all the posts in a given category. Then opening any of those posts leads to the same results – previous/next single page displays of date ordered posts in the category.

    This is the expected behavior. There are not options for showing in alphabetical order. There are no options for changing the date sorting of archive-like pages. I believe that sort order is settable for Page with Posts, but there is no way to change the archive-like pages.

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