Community Forums › Forums › Archived Forums › General Discussion › Adding Widget Area to Home Page in Balance
- This topic has 3 replies, 2 voices, and was last updated 9 years, 1 month ago by mstewar22.
-
AuthorPosts
-
March 10, 2015 at 11:33 pm #143968mstewar22Member
Hi,
I'd like to add a full width image below the navigation on the home page. I currently have the home page set to display posts and can't seem to figure out how to add a widget area. I've tried several things, The area appears in my widget list. I think I am not putting the code into the right template perhaps.March 10, 2015 at 11:42 pm #143970ItsPhippsMemberLet's take a look at the code you tried to see if we can figure out the problem.
March 10, 2015 at 11:47 pm #143971mstewar22MemberWell, I tried it in several places and probably added it way too many places, which template file is the blog home page? The page where you set the home page to display the latest blog posts? I have home.php, a page-landing and page-portfolio in my balance folder...
home.php was what i thought it would be on...so here's the code for that...
<?php
add_action( 'genesis_meta', 'balance_home_genesis_meta' );
/**
* Add widget support for homepage.
*
*/
function balance_home_genesis_meta() {if ( is_active_sidebar( 'Full-Width-Image' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
add_action( 'genesis_after_header', 'balance_home_loop_helper' );
}
}/**
* Display widget content for home featured sections.
*
*/
function balance_home_loop_helper() {if ( is_active_sidebar( 'Full-Width-Image' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
echo '<div id="home-featured"><div class="wrap clearfix">';
echo '<div class="full-width-image">';
dynamic_sidebar( 'Full-Width-Image' );
echo '</div><!-- end .full-width-image -->';echo '<div class="home-featured-left">';
dynamic_sidebar( 'home-featured-left' );
echo '</div><!-- end .home-featured-left -->';echo '<div class="home-featured-right">';
dynamic_sidebar( 'home-featured-right' );
echo '</div><!-- end .home-featured-right -->';echo '</div><!-- end .wrap --></div><!-- end #home-featured -->';
}
}
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper' );
/** Add support for Genesis Grid Loop **/
function child_grid_loop_helper() {if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 1,
'feature_image_size' => 0,
'feature_image_class' => 'align none post-image',
'feature_content_limit' => 0,
'grid_image_size' => 'grid',
'grid_image_class' => 'align none post-image',
'grid_content_limit' => 0,
'more' => __( 'Continue reading...', 'genesis' ),
'posts_per_page' => 3,
) );}
else {
genesis_standard_loop();
}}
genesis();
------------------------------------------------------------------------
added this code to functions.php:
genesis_register_sidebar( array(
'id' => 'Full-Width-Image',
'name' => __( 'Full Width Image', 'balance' ),
'description' => __( 'This is the fullwidth image', 'balance' )
) );
genesis_register_sidebar( array(
'id' => 'home-featured-left',
'name' => __( 'Home Featured Left', 'balance' ),
'description' => __( 'This is the featured left area on the homepage.', 'balance' ),
) );
genesis_register_sidebar( array(
'id' => 'home-featured-right',
'name' => __( 'Home Featured Right', 'balance' ),
'description' => __( 'This is the featured right area on the homepage.', 'balance' ),
) );
genesis_register_sidebar( array(
'id' => 'portfolio',
'name' => __( 'Portfolio', 'balance' ),
'description' => __( 'This is the portfolio page.', 'balance' ),
) );
add_action( 'genesis_after_header', 'Full-Width-Image' );
function your_widget() {
if ( is_front_page() && is_active_sidebar('Full-Width-Image') ) {
genesis_widget_area( 'Full-Width-Image', array(
'before' => '<div class="full-width-image">',
'after' => '</div>',
) );}
}
---------------------------------------------------------------
just the "full-width-image" parts..March 11, 2015 at 1:30 pm #144075mstewar22Memberhere is url...
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.