Community Forums › Forums › Archived Forums › Design Tips and Tricks › Grid Loop on Custom Blog Page
Tagged: grid loop on custom page
- This topic has 7 replies, 4 voices, and was last updated 10 years, 5 months ago by Eric Alexander.
-
AuthorPosts
-
October 18, 2013 at 8:43 am #67330Eric AlexanderMember
I am customizing Agency Theme for a restaurant. I want a header for a blog page so I created a page_blog.php page and inserted Brian's Grid Loop Code. The custom header I put on the page shows but there are no posts. Number of posts are set to 10 elsewhere in the backend such as Reading and Theme Settings.
When I put plain old 'do_loop' it displays posts, but we would like the grid. What do I need to change in the grid loop code to make it work on something besides home?
Here is the page template I created:
<?php /** * Genesis Framework. * * Please do all modifications in the form of a child theme. * * @package Genesis\Templates * @author StudioPress * @license GPL-2.0+ * @link http://my.studiopress.com/themes/genesis/ */ //* Template Name: Blog //* This blog page will display the BP Beer Buzz Blog posts and have page customizations. //* Add support for Genesis Grid Loop remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'child_grid_loop_helper' ); 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' ), ) ); } else { genesis_standard_loop(); } } //* Remove the post meta function for front page only remove_action( 'genesis_after_post_content', 'genesis_post_meta' ); genesis();
I found a very involved way to include the grid on non-home pages but the pages header image goes away, just like using the default Genesis Blog Template.
http://genesis.mywsiportal.com/genesis-grid-loop-advanced-htm/The client wants the site to remain closed while I work on it so I can't post the link.
Help! I'm stumped and I know it has to be simple.
http://bpdrafthouse.com/brew-buzz/October 18, 2013 at 12:40 pm #67389nutsandboltsMemberHi Eric,
Unfortunately, without a link it's difficult to say what might be causing the posts not to show, but here's my guess.
After "grid-content-limit" try adding this:
'posts_per_page' => 5,
(or whatever number you want to show)
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+October 18, 2013 at 12:52 pm #67394Sridhar KatakamParticipant'posts_per_page' is not a valid parameter for genesis_grid_loop() as far as I know.
http://my.studiopress.com/tutorials/genesis-grid-loop/
October 18, 2013 at 12:57 pm #67395nutsandboltsMemberIt used to be, but perhaps that has changed. http://wpsmith.net/2013/genesis/genesis-grid-loop-in-genesis-1-9/
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+October 18, 2013 at 6:39 pm #67479Eric AlexanderMemberARRHHG! I did get posts to show up on the blog page, but they are standard 'do_loop' not grid. I can not get Brian's Grid Code to show posts on the Blog template at all. I found code at:
http://genesis.mywsiportal.com/genesis-grid-loop-advanced-htm/
To make posts show up, but no grid. I put the code in functions.php and on the page_blog.php child page. No grid.
I did get the page header to show by adding the following to functions.php:
function wpsites_content_before_posts() { if ( is_page_template( 'page_blog.php' ) ) echo '<div class="before-blog"><IMG SRC="http://bpdrafthouse.com/wp-content/uploads/2013/09/blog-header.png" ALT="image"></div>'; }; add_action('genesis_before_loop', 'wpsites_content_before_posts');
So right now the blog page works, ie shows posts and has a custom page header, but not with the grid like I would like and that I told the client she could have.
Still working on it.
October 20, 2013 at 8:22 am #67818Sridhar KatakamParticipantFrom what I see it is not straight forward to use the grid loop in a custom page template. You will have to write queries for that. If you are not against using a plugin, you might want to consider using Views for this. Can be done easily.
October 20, 2013 at 10:13 am #67841Brad DaltonParticipantYou could duplicate the home page and use that as your blog page with a custom header.
October 27, 2013 at 10:27 pm #69396Eric AlexanderMemberOK Still no grid on the blog page, but the client likes it the way it is. I'm not sure she knows what the grid will look like. Regardless, it's launched, the blog has its own page header and they are tickled. I will update this post when and if I get a real fix.
Here's the link to the blog page I'm working on:
http://bpdrafthouse.com/brew-buzz/
Thanks for the input thus far..
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.