Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis Grid is not displaying on custom template
Tagged: genesis grid
- This topic has 2 replies, 2 voices, and was last updated 11 years, 1 month ago by csbeck.
-
AuthorPosts
-
March 11, 2013 at 8:38 am #25451csbeckMember
I've created a custom child theme for Genesis and I have custom templates that are used to show a grid of posts on main pages on my site - like this page: http://www.beckerstudio.com/portfolio/
The grid was showing up before I updated WordPress and Genesis as well as setting my PHP to 5.4. I tried resetting PHP to 5.2 but that didn't fix it.
The code I'm using on that page is: https://gist.github.com/csbeck/5134677
<?php
/**
* Template Name: Portfolio Grid
* This file displays a Grid within a page.
*/
add_action( 'genesis_post_content', 'genesis_do_post_content' );/**remove_action( 'genesis_loop', 'genesis_do_loop' );**/
add_action( 'genesis_loop', 'child_grid_loop' );
function child_grid_loop() {
$args = array(
'features' => 2,
'feature_image_size' => 'grid-feature-image',
'feature_image_class' => 'alignleft post-image',
'feature_content_limit' => 500,
'grid_image_size' => 'grid-thumbnail',
'grid_image_class' => 'alignleft post-image',
'grid_content_limit' => 0,
'loop' => 'custom',
'more' => __( '[Continue reading...]', 'genesis' ),
'posts_per_page' => 12,
);if ( genesis_get_custom_field( 'query_args' ) )
$args['cat'] = genesis_get_custom_field( 'query_args' );genesis_grid_loop( $args );
}/** Remove the post meta function for front page only **/
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
Can someone please help with getting my grid to show up again?Thanks! Chris
March 11, 2013 at 8:54 am #25452Brian BournMemberIt's probably due to your posts per page argument. With 1.9 there were a few changes announced with the grid loop and you will now need to get pre_get_posts first. This should get you to what you need to do. http://wpsmith.net/2013/genesis/genesis-grid-loop-in-genesis-1-9/
Bourn Creative | bourncreative.com | Twitter
March 13, 2013 at 8:08 am #25841csbeckMemberThanks so much Brian. This was a great help. It took a while to go through these (I guess I'm not as proficient in PHP so it was a little vague as to where all of this code needed to go). I found that I had to add the code to my functions.php. I was then able to set my pages templates to the blog template and it worked (mostly). http://www.beckerstudio.com/portfolio/design/websites/
I still wasn't able to see the 2 feature items on my particular pages. I did see the 2 features though if I went to an archive page.
http://www.beckerstudio.com/category/portfolio/portfolio-design/portfolio-websites/
I wonder if there's a way to get my regular pages set to the page_blog.php template to show this layout. I'm using a custom template on these pages because I wanted to show some introductory content above my portfolio pieces. Perhaps there a better way to do this?
My page_blog.php template uses this code:
<?php
/**
* WARNING: This file is part of the core Genesis framework. DO NOT edit
* this file under any circumstances. Please do all modifications
* in the form of a child theme.
*
* Template Name: Blog with Content
* This file handles blog post listings within a page.
*/
add_action('genesis_loop', 'genesis_standard_loop', 8);
genesis();I appreciate anyone's additional help or direction if possible. I'm almost there.
Thanks, Chris!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.