- This topic has 2 replies, 2 voices, and was last updated 4 years, 6 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Support › Forums › Flex Theme › Add Section To Home Page
I need to add a section to my home page under the home page middle, like “Home Page Middle 2” or something. Is there ay instructions on how to add this in the php files?
Add this code in your functions.php file. It will create the new widget area “Home Middle 2”.
genesis_register_sidebar( array(
'id' => 'home-middle-2',
'name' => __( 'Home Middle 2', 'flex' ),
'description' => __( 'This is the home middle 2 section.', 'flex' ),
) );
Now open the front-page.php file and find this function “flex_home_middle_bottom_widget_area” . Replace the all codes of that function with this new code:
function flex_home_middle_bottom_widget_area() {
if( is_active_sidebar('home-middle') ):
genesis_widget_area( 'home-middle', array(
'before' => '<div class="home-middle" id="home-middle">',
'after' => '</div>',
) );
endif;
if( is_active_sidebar('home-middle-2') ):
genesis_widget_area( 'home-middle-2', array(
'before' => '<div class="home-middle-2" id="home-middle-2">',
'after' => '</div>',
) );
endif;
if( is_active_sidebar('home-bottom-left') || is_active_sidebar('home-bottom-right') ):
printf( '<div %s>', genesis_attr( 'home-bottom' ) );
genesis_widget_area( 'home-bottom-left', array(
'before' => '<div class="home-bottom-left">',
'after' => '</div>',
) );
genesis_widget_area( 'home-bottom-right', array(
'before' => '<div class="home-bottom-right">',
'after' => '</div>',
) );
echo '</div>' . "\n";
endif;
}
Note: Before editing the files you will keep a backup of your child theme.
Awesome! Thank YOU!!!