• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Show Latest Posts on front-page.php

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.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Show Latest Posts on front-page.php

This topic is: not resolved

Tagged: front page, Genesis Grid Loop, Latest Posts

  • This topic has 6 replies, 2 voices, and was last updated 8 years, 7 months ago by Chris.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • August 15, 2014 at 2:42 pm #119096
    Chris
    Member

    Hi,

    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

    https://www.dropbox.com/s/t67sp3qbkieamti/Screenshot%202014-08-15%2015.39.01.png
    August 15, 2014 at 2:44 pm #119098
    Genesis Developer
    Member

    Try 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();
    	}
    }

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    August 15, 2014 at 2:49 pm #119101
    Chris
    Member

    Thanks, 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 #119103
    Genesis Developer
    Member

    Remove 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 );

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    August 15, 2014 at 3:01 pm #119106
    Chris
    Member

    I 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 #119107
    Genesis Developer
    Member

    Hmmm...remove the home page name from Settings -> Reading section . You don't need this. because you're using front-page.php file.


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    August 15, 2014 at 3:06 pm #119109
    Chris
    Member

    Thanks. 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

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble