Community Forums › Forums › Archived Forums › Design Tips and Tricks › Add Widget Area Before Footer On Home Page Lifestyle Pro Theme
Tagged: before footer, genesis_before_footer, lifestyle Pro
- This topic has 9 replies, 3 voices, and was last updated 6 years, 6 months ago by TonySan1.
-
AuthorPosts
-
May 28, 2018 at 9:48 pm #220324TonySan1Member
Hello folks, could anyone tell me how to add a widget area before the footer area (after entry widget area) on the home page of the Genisis Lifestyle Pro Theme. What code should I use and where should it go? I found the steps online for adding it to post pages and it works fine but the widget area doesn't show up on the homepage. Can you help?
http://diyinternetmarketer.comMay 29, 2018 at 11:21 am #220351AnitaCKeymasterWhat code did you use for it to display on the pages. Drop it in here so we can see what you used.
Need help with customization or troubleshooting? Reach out to me.
May 29, 2018 at 2:30 pm #220355Brad DaltonParticipantTry this code
You can add a conditional check after the function name like this :
if ( is_front_page() )
May 29, 2018 at 10:17 pm #220373TonySan1MemberThis is the code that displasys my after entry widget for post pages. Located in my functions php. What do i need to do to have the widget area on my home page?
`// Add support for after entry widget.
add_theme_support( 'genesis-after-entry-widget-area' );// Relocate after entry widget.
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );
add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 5 );May 29, 2018 at 11:12 pm #220375TonySan1MemberIs there a way for me to put the after entry widget only on my home page and post pages. I don't want it to show on any other pages except the home page.
Here Is the after entry widget area Code In my Functions php.
// Close wrap within site-container.
add_action( 'genesis_after_footer', 'lifestyle_close_site_container_wrap' );
function lifestyle_close_site_container_wrap() {
echo '</div>';
}// Add support for 3-column footer widgets.
add_theme_support( 'genesis-footer-widgets', 3 );// Add support for after entry widget.
add_theme_support( 'genesis-after-entry-widget-area' );// Relocate after entry widget.
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );
add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 5 );// Register widget areas.
genesis_register_sidebar( array(
'id' => 'home-top',
'name' => __( 'Home - Top', 'lifestyle-pro' ),
'description' => __( 'This is the top section of the homepage.', 'lifestyle-pro' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle',
'name' => __( 'Home - Middle', 'lifestyle-pro' ),
'description' => __( 'This is the middle section of the homepage.', 'lifestyle-pro' ),
) );
genesis_register_sidebar( array(
'id' => 'home-bottom-left',
'name' => __( 'Home - Bottom Left', 'lifestyle-pro' ),
'description' => __( 'This is the bottom left section of the homepage.', 'lifestyle-pro' ),
) );
genesis_register_sidebar( array(
'id' => 'home-bottom-right',
'name' => __( 'Home - Bottom Right', 'lifestyle-pro' ),
'description' => __( 'This is the bottom right section of the homepage.', 'lifestyle-pro' ),
) );May 29, 2018 at 11:23 pm #220376Brad DaltonParticipantWhere exactly on your home page? Which specific hook position?
Try this code https://gist.github.com/braddalton/1bd36b2a5b42adb560d6dd55cd3279e5
Change the hook if needed.
May 30, 2018 at 12:29 pm #220393TonySan1MemberPlease help, here is the code on my functions php. I tried adding the code above to the bottom of my functions php and it broke my site. I was able to add a widget area right above the s 3 columb footer section which I wanted. I am just having a really hard time adding a new widget area right above my lower footer. I do have an after entry widget area already showing on my post pages, I also want it to show on my homepage as well. can you plese help me with the code i will need and where to put it so that it won't break my site. I am using SFTP to edit my functions php code because it won't work fro the WP admin editor. Here here is all the code on my functions php:
<?php
/**
* Lifestyle Pro.
*
* This file adds the functions to the Lifestyle Pro Theme.
*
* @package Lifestyle
* @author StudioPress
* @license GPL-2.0+
* @link http://my.studiopress.com/themes/lifestyle/
*/// Start the engine.
include_once( get_template_directory() . '/lib/init.php' );// Setup Theme.
include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' );// Set Localization (do not remove).
add_action( 'after_setup_theme', 'lifestyle_localization_setup' );
function lifestyle_localization_setup(){
load_child_theme_textdomain( 'lifestyle-pro', get_stylesheet_directory() . '/languages' );
}// Add the theme helper functions.
include_once( get_stylesheet_directory() . '/lib/helper-functions.php' );// Add Color select to WordPress Theme Customizer.
require_once( get_stylesheet_directory() . '/lib/customize.php' );// Include Customizer CSS.
include_once( get_stylesheet_directory() . '/lib/output.php' );// Add WooCommerce support.
include_once( get_stylesheet_directory() . '/lib/woocommerce/woocommerce-setup.php' );// Add the WooCommerce customizer CSS.
include_once( get_stylesheet_directory() . '/lib/woocommerce/woocommerce-output.php' );// Include notice to install Genesis Connect for WooCommerce.
include_once( get_stylesheet_directory() . '/lib/woocommerce/woocommerce-notice.php' );// Child theme (do not remove).
define( 'CHILD_THEME_NAME', __( 'Lifestyle Pro', 'lifestyle-pro' ) );
define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/lifestyle/' );
define( 'CHILD_THEME_VERSION', '3.2.4' );// Add HTML5 markup structure.
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );// Add Accessibility support.
add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) );// Add viewport meta tag for mobile browsers.
add_theme_support( 'genesis-responsive-viewport' );// Enqueue Scripts.
add_action( 'wp_enqueue_scripts', 'lifestyle_load_scripts' );
function lifestyle_load_scripts() {wp_enqueue_style( 'dashicons' );
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Droid+Sans:400,700|Roboto+Slab:400,300,700', array(), CHILD_THEME_VERSION );
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script( 'lifestyle-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menus' . $suffix . '.js', array( 'jquery' ), CHILD_THEME_VERSION, true );
wp_localize_script(
'lifestyle-responsive-menu',
'genesis_responsive_menu',
lifestyle_responsive_menu_settings()
);}
// Define our responsive menu settings.
function lifestyle_responsive_menu_settings() {$settings = array(
'mainMenu' => __( 'Menu', 'lifestyle-pro' ),
'subMenu' => __( 'Submenu', 'lifestyle-pro' ),
'menuClasses' => array(
'combine' => array(
'.nav-primary',
'.nav-header',
'.nav-secondary',
),
),
);return $settings;
}
// Add image sizes.
add_image_size( 'home-large', 634, 360, TRUE );
add_image_size( 'home-small', 266, 160, TRUE );// Add support for custom background.
add_theme_support( 'custom-background', array(
'default-image' => get_stylesheet_directory_uri() . '/images/bg.png',
'default-color' => 'efefe9',
) );// Add support for custom header.
add_theme_support( 'custom-header', array(
'flex-height' => true,
'header_image' => '',
'header-selector' => '.site-title a',
'header-text' => false,
'height' => 220,
'width' => 640,
) );// Rename menus.
add_theme_support( 'genesis-menus', array( 'primary' => __( 'Before Header Menu', 'lifestyle-pro' ), 'secondary' => __( 'After Header Menu', 'lifestyle-pro' ) ) );// Remove output of primary navigation right extras.
remove_filter( 'genesis_nav_items', 'genesis_nav_right', 10, 2 );
remove_filter( 'wp_nav_menu_items', 'genesis_nav_right', 10, 2 );// Remove navigation meta box.
add_action( 'genesis_theme_settings_metaboxes', 'lifestyle_remove_genesis_metaboxes' );
function lifestyle_remove_genesis_metaboxes( $_genesis_theme_settings_pagehook ) {
remove_meta_box( 'genesis-theme-settings-nav', $_genesis_theme_settings_pagehook, 'main' );
}// Add ID to secondary navigation.
add_filter( 'genesis_attr_nav-secondary', 'lifestyle_add_nav_secondary_id' );
function lifestyle_add_nav_secondary_id( $attributes ) {$attributes['id'] = 'genesis-nav-secondary';
return $attributes;
}
// Remove skip link for primary navigation.
add_filter( 'genesis_skip_links_output', 'lifestyle_skip_links_output' );
function lifestyle_skip_links_output( $links ) {if ( isset( $links['genesis-nav-primary'] ) ) {
unset( $links['genesis-nav-primary'] );
}$new_links = $links;
array_splice( $new_links, 0 );if ( has_nav_menu( 'secondary' ) ) {
$new_links['genesis-nav-secondary'] = __( 'Skip to secondary menu', 'lifestyle-pro' );
}return array_merge( $new_links, $links );
}
// Open wrap within site-container.
add_action( 'genesis_before_header', 'lifestyle_open_site_container_wrap' );
function lifestyle_open_site_container_wrap() {echo '<div class="site-container-wrap">';
}
// Reposition the primary navigation.
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav' );// Modify the size of the Gravatar in the author box.
add_filter( 'genesis_author_box_gravatar_size', 'lifestyle_author_box_gravatar' );
function lifestyle_author_box_gravatar( $size ) {
return 96;
}// Modify the size of the Gravatar in the entry comments.
add_filter( 'genesis_comment_list_args', 'lifestyle_comments_gravatar' );
function lifestyle_comments_gravatar( $args ) {$args['avatar_size'] = 60;
return $args;
}
// Close wrap within site-container.
add_action( 'genesis_after_footer', 'lifestyle_close_site_container_wrap' );
function lifestyle_close_site_container_wrap() {
echo '</div>';
}// Add support for 3-column footer widgets.
add_theme_support( 'genesis-footer-widgets', 3 );// Add support for after entry widget.
add_theme_support( 'genesis-after-entry-widget-area' );// Relocate after entry widget.
remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' );
add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 5 );// Register widget areas.
genesis_register_sidebar( array(
'id' => 'home-top',
'name' => __( 'Home - Top', 'lifestyle-pro' ),
'description' => __( 'This is the top section of the homepage.', 'lifestyle-pro' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle',
'name' => __( 'Home - Middle', 'lifestyle-pro' ),
'description' => __( 'This is the middle section of the homepage.', 'lifestyle-pro' ),
) );
genesis_register_sidebar( array(
'id' => 'home-bottom-left',
'name' => __( 'Home - Bottom Left', 'lifestyle-pro' ),
'description' => __( 'This is the bottom left section of the homepage.', 'lifestyle-pro' ),
) );
genesis_register_sidebar( array(
'id' => 'home-bottom-right',
'name' => __( 'Home - Bottom Right', 'lifestyle-pro' ),
'description' => __( 'This is the bottom right section of the homepage.', 'lifestyle-pro' ),
) );
genesis_register_sidebar( array(
'id' => 'before-footer',
'name' => __( 'Before Footer' ),
) );June 1, 2018 at 4:34 pm #220461TonySan1MemberHi folks, I am still desperately seeking help with adding this widget area into my Lifestyle Pro Theme. Here's what going on. In my theme there is a default 3 column footer widget area as well as footer for a nav bar below it. I want to put a widget area right between the two of them only on the home page. Can this be done? Can you help?
June 2, 2018 at 3:55 am #220467Brad DaltonParticipantPlease copy the PHP code from the view raw link in the Gist and paste it at the end of your child themes functions file using a code editor.
Do not use the WordPress theme editor.
The code is tested and works.
June 2, 2018 at 11:58 am #220470TonySan1MemberBrad thank you so much man! The code worked like you said it would like a charm. Very thankful. I think it broke my site the first time I added it because I used the WP admin funtions php editor. It worked fine when I used the Hftp editor. Can't thank you enough!
Tony -
AuthorPosts
- The topic ‘Add Widget Area Before Footer On Home Page Lifestyle Pro Theme’ is closed to new replies.