Community Forums › Forums › Archived Forums › General Discussion › Show Latest Posts on front-page.php
Tagged: front page, Genesis Grid Loop, Latest Posts
- This topic has 6 replies, 2 voices, and was last updated 10 years, 7 months ago by
Chris.
-
AuthorPosts
-
August 15, 2014 at 2:42 pm #119096
Chris
MemberHi,
I am trying to add a section with my latest posts to my front-page.php template and I'm having an issue. Instead of showing my latest posts it is instead displaying the page I have set as home in Settings>Reading:
https://www.dropbox.com/s/t67sp3qbkieamti/Screenshot%202014-08-15%2015.39.01.png
The code I'm using to add the latest posts is here:
//* Genesis grid loop function minimum_grid_loop_helper() { if ( function_exists( 'genesis_grid_loop' ) ) { genesis_grid_loop( array( 'features' => 0, 'feature_image_size' => 0, 'feature_content_limit' => 0, 'grid_image_size' => 0, 'grid_content_limit' => 250, 'more' => __( '[Read more]', 'minimum' ), ) ); } else { genesis_standard_loop(); } }
I'm not using the page_blog.php template and I'm using the reading setting to define the home page and the blog page. Everything looks great except the latest posts not showing correctly in the front_page.php template.
Any ideas?
Thanks for the help!
-Chris
Chris Reed | [email protected] | http://www.chrisreedtech.com
August 15, 2014 at 2:44 pm #119098Genesis Developer
MemberTry this way
remove_action('genesis_loop', 'genesis_do_loop'); add_action('genesis_loop', 'minimum_grid_loop_helper'); //* Genesis grid loop function minimum_grid_loop_helper() { if ( function_exists( 'genesis_grid_loop' ) ) { genesis_grid_loop( array( 'features' => 0, 'feature_image_size' => 0, 'feature_content_limit' => 0, 'grid_image_size' => 0, 'grid_content_limit' => 250, 'more' => __( '[Read more]', 'minimum' ), ) ); } else { genesis_standard_loop(); } }
August 15, 2014 at 2:49 pm #119101Chris
MemberThanks, but that didn't work either. I should have posted this function I have above in the front-page.php:
//* Add widget support for homepage if widgets are being used add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' ); function minimum_front_page_genesis_meta() { if ( is_front_page() ) { //* Remove entry meta in entry footer and Genesis loop remove_action( 'genesis_loop', 'genesis_do_loop' ); //* Add Genesis grid loop add_action( 'genesis_loop', 'minimum_grid_loop_helper' ); //* Remove entry footer functions remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); //* Force full width content layout add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); }
Chris Reed | [email protected] | http://www.chrisreedtech.com
August 15, 2014 at 2:54 pm #119103Genesis Developer
MemberRemove these lines.
//* Add widget support for homepage if widgets are being used add_action( ‘genesis_meta’, ‘minimum_front_page_genesis_meta’ ); function minimum_front_page_genesis_meta() { if ( is_front_page() ) { }
Do this simple way. Just use this code in your file
//* Force full width content layout add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); //* Remove entry meta in entry footer and Genesis loop remove_action( 'genesis_loop', 'genesis_do_loop' ); //* Add Genesis grid loop add_action( 'genesis_loop', 'minimum_grid_loop_helper' ); //* Remove entry footer functions remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
August 15, 2014 at 3:01 pm #119106Chris
MemberI don't think thats the problem. The function is getting called correctly, it is just returning the home page name instead of the posts for some reason.
Chris Reed | [email protected] | http://www.chrisreedtech.com
August 15, 2014 at 3:04 pm #119107Genesis Developer
MemberHmmm...remove the home page name from Settings -> Reading section . You don't need this. because you're using front-page.php file.
August 15, 2014 at 3:06 pm #119109Chris
MemberThanks. I tried that and with no page set it shows the latest blog posts instead of the front-page.php template. Which is weird because I thought the template hierarchy always looked for front-page.php first.
Chris Reed | [email protected] | http://www.chrisreedtech.com
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.