-
Search Results
-
[Resolved]
Topic: Grid Loop in Genesis 1.9 not working on pages
We have a site that has a page that pulls in other pages using the old grid loop in Genesis 1.8. This is no longer working in Genesis 1.9
Here is the code that we are using.
https://gist.github.com/4542358
Looked at the different tutorials that are out there but they don't seem to work for this circumstance.
Can anyone help?
Thank you
Hello!
Previously in Genesis 1.8x I was using multiple custom grid loops to display recent posts on the home page, broken out in sections, each containing recent posts from a different category.
To accomplish this I did the following:
function child_maybe_do_grid_loop() {// Amend this conditional to pick where this grid looping occurs
if ( ! is_single() && ! is_page() && ! is_archive() && ! is_search() ) {// Remove the standard loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
// Add another prepared grid loop
add_action( 'genesis_loop', 'child_do_grid_loop_cat1' );
// Add another prepared grid loop
add_action( 'genesis_loop', 'child_do_grid_loop_cat2' );
// Add another prepared grid loop
add_action( 'genesis_loop', 'child_do_grid_loop_cat3' );
// Add another prepared grid loop
add_action( 'genesis_loop', 'child_do_grid_loop_cat4' );
// Use the prepared grid loop
add_action( 'genesis_loop', 'child_do_grid_loop' );// Add some extra post classes to the grid loop so we can style the columns
add_filter( 'genesis_grid_loop_post_class', 'child_grid_loop_post_class' );
}
}
In each loop I would have custom arguments for each section like this:
function child_do_grid_loop_cat1() {global $query_string, $paged;
// Ensure the arguments for the normal query for the page are carried forwards
// If you're using a Page to query the posts (e.g. with the Blog template), comment out the next line.
wp_parse_str( $query_string, $query_args );// Create an array of arguments for the loop - can be grid-specific, or
// normal query_posts() arguments to alter the loop
// Cupcakes Category
$grid_args = array(
'features' => 0,
'feature_image_size' => 'grid-featured',
'feature_image_class' => 'alignleft post-image',
'feature_content_limit' => 250,
'grid_image_size' => 'grid-thumbnail',
'grid_image_class' => 'alignleft post-image',
'grid_content_limit' => 150,
'more' => __( 'Continue reading →', 'genesis' ),
'cat' => '5',
'posts_per_page' => 3,
);// Make sure the first page has a balanced grid
if ( 0 == $paged )
// If first page, add number of features to grid posts, so balance is maintained
$grid_args['posts_per_page'] += $grid_args['features'];
else
// Keep the offset maintained from our page 1 adjustment
$grid_args['offset'] = ( $paged - 1 ) * $grid_args['posts_per_page'] + $grid_args['features'];// Merge the standard query for this page, and our preferred loop arguments
genesis_grid_loop( array_merge( (array) $query_args, $grid_args ) );}
Now I have been reading that this method has been changed or depreciated with Genesis 1.9x. I have seen the new code and understand how I could use it to display only one category on the home page in a grid, but I do not know how to manipulate the code to accomplish what I had going on before which is multiple grid loops on the home page displaying different categories.
Anyone have any ideas?
Thanks in advance!
Neil
Welcome!
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.