Eleven40 Theme: Add Featured Posts Widget to Home

Community Forums Forums Design Tips and Tricks Eleven40 Theme: Add Featured Posts Widget to Home

This topic is: not resolved

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  braddalton 10 months, 4 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42183

    brunowa
    Participant
    Post count: 11

    Hi there,

     

    My site is at http://www.gradskills.com.au and I am currently using the Eleven40 theme.

    I want to add a ‘Featured Posts’ area to my homepage like that in the ‘home-bottom’ widget of the Metro/News themes.

     

    How do I go about doing this?

     

    Brendan

    http://www.gradskills.com.au
    #42185

    braddalton
    Participant
    Post count: 7438
    #42189

    brunowa
    Participant
    Post count: 11

    I would want it on the homepage so not sure the hooks will work? I believe I have to register a a widget area for the homepage… it’s to be like the featured posts (#4, 5, 6) at the bottom of the Metro theme like this:

     

    http://demo.studiopress.com/metro/

     

     

    #42193

    braddalton
    Participant
    Post count: 7438

    Take the PHP code from the Metro home.php file for the home-bottom widgets and paste it into the Eleven40 home.php file.

    function metro_home_genesis_meta() {
    
    if ( is_active_sidebar( 'home-bottom' ) ) {
    
    // Force content-sidebar layout setting
    add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    // Add metro-home body class
    add_filter( 'body_class', 'metro_body_class' );
    function metro_body_class( $classes ) {
     $classes[] = 'metro-home';
     return $classes;
    		}
    // Remove the default Genesis loop
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    // Add homepage widgets
    		add_action( 'genesis_loop', 'metro_homepage_widgets' );
    }
    }
    
    add_action( 'genesis_meta', 'metro_home_genesis_meta' );
    function metro_homepage_widgets() {
    genesis_widget_area( 'home-bottom', array(
    		'before' => '<div class="home-bottom widget-area">',
    	) );
    }
    

    You’ll need to make some modifications to the code and add some css as well.

    Then you’ll need to register the widget in the functions.php file:

    genesis_register_sidebar( array(
    	'id'				=> 'home-bottom',
    	'name'			=> __( 'Home - Bottom', 'metro' ),
    	'description'	=> __( 'This is the bottom section of the homepage.', 'metro' ),
    ) );
    

    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.