Displaying a grid of page children
-
I have a custom post type (online_exhibit) that is hierarchical and has page attributes. I wish to use the Post List Grid to display a single post’s children beneath the single post’s content. My code to achieve this is below:
$pc_args = array( 'posts_per_page' => -1, 'post_type' => 'online_exhibit', 'post_parent' => get_the_ID(), 'orderby' => 'menu_order, title', 'order' => 'ASC', 'post_status' => 'publish' ); $pc_query = new WP_Query($pc_args); if ($pc_query->have_posts()) { while ($pc_query->have_posts()) { $pc_query->the_post(); czr_fn_render_template( 'modules/grid/grid_wrapper', array( 'model_id' => 'post_list_grid', 'model_args' => array( 'grid_columns' => 2, 'image_centering' => 'js-centering', 'show_thumb' => 1 ) ) ); } wp_reset_postdata(); }
My issue is that instead of displaying the child posts in the same grid, a new grid is started for each individual post. I wish to use two columns, but the resulting display is a single column of posts. The column width is half the width of the overall page. When I look at the source code, I can see that each post is contained in its own “grid-container” div. The correct behavior would be for all the posts to be contained within a single “grid-container” div.
What am I doing wrong?
Note: This is for a local development site, so I cannot provide a link.
- The topic ‘Displaying a grid of page children’ is closed to new replies.