This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Custom Query in Layout Builder

  • Creator
    Topic
  • #1588
    gingey
    Member

    This is driving me nuts and I’m sure it’s something simple. I am in the layout builder adding a Post Grid to a page. I want to use a custom query to display only specific posts by ID and in a specific order- i.e. I want to get posts 2, 4, and 6, but display 6, then 2, then 4.
    From the WP_Query parameters page, I should be able to do something like:
    orderby=post__in&’post__in’=array(6, 2, 4)
    I can’t get it to work. It displays all the posts (1-6) and in order by newest first. Been messing with different versions of this for an hour trying to get it to show correctly. Any tips on what I can type in the Custom Query String field in the Layout Builder under the Post Grid to get this to work?
    If I type a super simple query like p=2, it works just fine. I also see that using ‘post__in’ with orderby is only supported in 3.5, which I am running. It is a new site I uploaded today.
    Thanks.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #1592
    Jason Bobich
    Keymaster

    Unfortunately, this isn’t going to work. You can not use these more complex items like the “post__in” parameter in a single query string. The only way I’m aware of to accomplish this would be through customization from your Child theme’s functions.php.

    See my answer here in this topic: http://support.themeblvd.com/forums/topic/tip-simulate-post-grid-for-specific-pages/

    With that little trick (#2 on my original response there) that’ll give you a little trick you can do in order to actually get complete control over a query.

Viewing 1 replies (of 1 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.