Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom Page Template using grid loop metric theme
- This topic has 5 replies, 3 voices, and was last updated 11 years, 6 months ago by krystyn.
-
AuthorPosts
-
February 9, 2013 at 4:16 pm #19293charriott4Member
Im trying to create a custom blog page template using the grid loop but nothing is working?
http://quench-essential.com/ingredients/
<?php
/**
* Template Name: Blog
*/remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper' );
/** Add support for Genesis Grid Loop **/
function child_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 2,
'feature_image_size' => 0,
'feature_image_class' => 'alignleft post-image',
'feature_content_limit' => 0,
'grid_image_size' => 'grid-thumbnail',
'grid_image_class' => 'alignleft post-image',
'grid_content_limit' => 0,
'more' => __( '[Continue reading...]', 'genesis' ),
'posts_per_page' => 6,
'cat' => '6,7' //enter your category IDs here separated by commas in ' '
) );
} else {
genesis_standard_loop();
}
}/** Remove the post meta function for front page only **/
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
genesis();
Web Designs By Chrissy | Twitter @designbychrissy
February 19, 2013 at 1:42 pm #21410cdilsParticipantI don't think the Metric theme uses the grid loop. Does it? If not, you'll need to include the function, before you can call it.
So this line if ( function_exists( ‘genesis_grid_loop’ ) ) will return false because the function doesn't exist.
If you don't want to install the grid loop code manually (http://www.billerickson.net/a-better-and-easier-grid-loop/), you could try using the Genesis Grid Loop plugin. Might save you creating/using a custom template altogether. 🙂
Carrie
Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂
I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.
February 20, 2013 at 7:29 pm #21847krystynParticipantI'm soooo glad I found this post. Which of the theme use the grid loop? Is there a good way to find this out?
I'm assuming this same code would work for any template I would want to create? Like a custom category page?
February 20, 2013 at 7:52 pm #21852charriott4MemberFebruary 20, 2013 at 7:58 pm #21853krystynParticipantI guess it's time to learn how to create a custom template. Thanks.
February 20, 2013 at 8:19 pm #21856krystynParticipantHmmmm...I added a template and used it on a page.
I think I got all of the smart quotes from copying it, but I'm getting an error when I try to view the page.
Any glaring issues?
<?php
/**
* Template Name: Categories
*/remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper' );
/** Add support for Genesis Grid Loop **/
function child_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 2,
'feature_image_size' => 0,
'feature_image_class' => 'alignleft post-image',
'feature_content_limit' => 0,
'grid_image_size' => 'grid-thumbnail',
'grid_image_class' => 'alignleft post-image',
'grid_content_limit' => 0,
'more' => __( '[Continue reading...]', 'genesis' ),
'posts_per_page' => 6,
'cat => '1' //enter your category IDs here separated by commas in ' '
) );
} else {
genesis_standard_loop();
}
}/** Remove the post meta function for front page only **/
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
genesis(); -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.