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.

Create Post Grid-like Display from Pages

  • Creator
    Topic
  • #20442
    kennethfeldman
    Participant

    Hi Jason,

    Is there a way to create a Post Grid -like display of PAGES and their featured images and page titles?

    I have 12 books currently each as a post, and the post grid works fine to display a grid of book covers with the title below.

    MY DILEMMA is that I really want to use a custom layout for these posts, but as you know, that’s a problem. Even the layouts to posts plugin doesn’t work for me, since I want the builder to appear on each post the way it does on pages.

    But I could easily change the Book posts to be pages instead, and gain all of the custom layout features I desire.

    But I really like the ease with which the Display Posts Grid shortcode works, and was wondering if there’s a way to make that work to display Pages in a grid?

    (I know there are manual ways of making a grid of linked images, but…)

    Any insights here?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #20449
    Jason Bobich
    Keymaster

    You’d have to use a custom query within your shortcode usage. But this gets tricky, without using PHP customization like this, because there’s no way to write a query string in WordPress that designates specific page ID’s to pull (last time I checked, anyway).

    WordPress does however allow you to pull all child pages of a parent page with post_parent parameter in a query string. So you could take some page and then make a set of pages child pages of it. Then pull them like this:

    [post_grid query="post_parent=123"]

    … where “123” is the ID of the parent page.

    http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters

    #20455
    kennethfeldman
    Participant

    Thanks, but I’ve done this, and get the No Posts To Display message:

    [post_grid columns=”3″ rows=”5″ orderby=”date” order=”DESC” query=”post_parent=83″]

    I have 12 pages that are sub-pages of page ID #83 — but no joy.

    Any sense of what’s wrong?

    #20457
    Jason Bobich
    Keymaster

    I think the trick is that you need to also set the post_type.

    [post_grid columns="3" rows="5" query="post_type=page&post_parent=83"]

    Note that these parameters — orderby="date" order="DESC" — are no longer relevant when using a custom query string. If you wanted to use these parameters, you’d incorporate them into the query string. But with pages it’d probably make the most sense to set the “Order” when editing your pages, and then use orderby=menu_order in your query string.

    [post_grid columns="3" rows="5" query="post_type=page&post_parent=83&orderby=menu_order"]

    http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

    #20459
    kennethfeldman
    Participant

    So great!

    Now it works BUT is returning ALL pages in the entire site, and is not restricting to child pages of #83.

    Also it’s listing all pages in reverse order of date created — no matter whether I use orderby=rand, date, title, or any other one.

    Can I get one more bit of advice here?

    Thanks!

    #20462
    Jason Bobich
    Keymaster

    From what you’re describing it sounds like the part of the query string past the first & just isn’t getting processed. The way I presented to you worked on my server, but on your end try using the HTML representation of the ampersand & instead, and see if that does the trick.

    query="post_type=page&post_parent=83&orderby=menu_order"
    #20466
    kennethfeldman
    Participant

    Of course. That was it.

    (You’ve advised me as such in the past, but I forgot. Sorry!)

    Thanks Jason, you’re the best!

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