• gg88

    (@gg88)


    Hey,

    thanks for this wonderful plugin. On my website, I have a portfolio that is based on the post format. I am using the custom order for the portfolio. On the blog, I just want to have a descending order, but somehow the posts are shown all random. Could I deactivate the custom order for the blog posts, without affecting the portfolio?

    I found this code online:

    add_filter('pto/posts_orderby/ignore', 'theme_pto_posts_orderby', 10, 3);
       function theme_pto_posts_orderby($ignore, $orderBy, $query)
          {
              if( (! is_array($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'post') || 
                      (is_array($query->query_vars)   &&  in_array('post', $query->query_vars)))
                      $ignore = TRUE;
              
              
              return $ignore;
          }

    This code helped for having the regular order for the blog posts, but unfortunately, my custom order for the portfolio was not working anymore.

    Please help!

    • This topic was modified 5 years ago by gg88.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Maya

    (@tdgu)

    Hi,
    If the posts are show random, it means there’s another code/plugin which filter that area and randomize, unless this is how it should show as default.
    So even if you set to ignore for that area, it will still not working, since the plugin does not actually affect the order for that area.

    Thanks

    Thread Starter gg88

    (@gg88)

    Hey, if I deactivate the plugin, then the order for the blog posts is correct. So how can I fix that?

    Thanks!

    Thread Starter gg88

    (@gg88)

    FYI: I checked the posts order tab and it has the right order, but still on the live website there is a random view.
    Hope you can find a solution for this problem

    Plugin Author Maya

    (@tdgu)

    Hi,
    Sorry but there’s nothing to fix from this side, check with your theme code and possible other plugins, as there should be a query which randomize the order of posts.

    Thanks

    Thread Starter gg88

    (@gg88)

    How can this be? When I deactivate the plugin then it shows the right order. So there must be a problem. How can I check if a query randomizes it? Maybe you could help me at least with the code? How can I make sure that the blog posts would be ignored and my portfolio would have the custom order?

    Plugin Author Maya

    (@tdgu)

    Turn off the Autosort, then add the ‘orderby’ => ‘menu_order’ argument to the queries where the order is required to apply, see https://www.nsp-code.com/advanced-post-types-order-api/sample-usage/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Deactivating Post types order for blog posts’ is closed to new replies.