Community Forums › Forums › Archived Forums › Design Tips and Tricks › Add Full WIdth Widget to News Theme
- This topic has 3 replies, 2 voices, and was last updated 11 years, 1 month ago by SoZo.
-
AuthorPosts
-
January 31, 2013 at 12:43 pm #16789fantasticwriterMember
Is it possible to, and how do I add a full width widget area to the top of the News theme home page? I have created and registered a new widget area, but it does not extend to full width. The sidebar widget of the home page is in the way. How do I lower the sidebar widget so the new widget will display across the top of the page.
The site is http://www.808grindz.com
Thanks,
MauryJanuary 31, 2013 at 1:33 pm #16799SoZoMemberHow did you add the sidebar? What hook did you use?
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 31, 2013 at 1:39 pm #16809fantasticwriterMemberI modified the home.php file and the functions.php file with the information for 'home-slider'. :
<?php
add_action( 'genesis_meta', 'news_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function news_home_genesis_meta() {if ( is_active_sidebar( 'home-slider' ) || is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) || is_active_sidebar( 'home-bottom' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'news_home_loop_helper' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
add_filter( 'body_class', 'add_body_class' );
function add_body_class( $classes ) {
$classes[] = 'news';
return $classes;
}}
}function news_home_loop_helper() {
if ( is_active_sidebar( 'home-slider' ) ) {
echo '<div id="home-slider"><div class="border wrap">';
dynamic_sidebar( 'home-slider' );
echo '</div><!-- end .border wrap --></div><!-- end #home-slider -->';}
if ( is_active_sidebar( 'home-top' ) ) {
echo '<div id="home-top"><div class="border wrap">';
dynamic_sidebar( 'home-top' );
echo '</div><!-- end .border wrap --></div><!-- end #home-top -->';}
if ( is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) ) {
echo '<div id="home-middle"><div class="border wrap">';
echo '<div class="home-middle-left">';
dynamic_sidebar( 'home-middle-left' );
echo '</div><!-- end .home-middle-left -->';echo '<div class="home-middle-right">';
dynamic_sidebar( 'home-middle-right' );
echo '</div><!-- end .home-middle-right -->';echo '</div><!-- end .border wrap --></div><!-- end #home-middle -->';
}
if ( is_active_sidebar( 'home-bottom' ) ) {
echo '<div id="home-bottom"><div class="border wrap">';
dynamic_sidebar( 'home-bottom' );
echo '</div><!-- end .border wrap --></div><!-- end #home-bottom -->';}
}
genesis();
======================
<?php
/** Start the engine */
require_once( get_template_directory() . '/lib/init.php' );/** Create additional color style options */
add_theme_support( 'genesis-style-selector', array( 'news-green' => 'Green', 'news-orange' => 'Orange', 'news-pink' => 'Pink', 'news-purple' => 'Purple', 'news-red' => 'Red', 'news-teal' => 'Teal' ) );/** Child theme (do not remove) */
define( 'CHILD_THEME_NAME', 'News Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/themes/news' );$content_width = apply_filters( 'content_width', 610, 460, 910 );
/** Add support for structural wraps */
add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) );/** Add new image sizes */
add_image_size( 'home-bottom', 110, 110, TRUE );
add_image_size( 'home-middle-left', 280, 165, TRUE );
add_image_size( 'home-middle-right', 50, 50, TRUE );
add_image_size( 'home-tabs', 150, 220, TRUE );/** Add support for custom background */
add_custom_background();/** Add support for custom header */
add_theme_support( 'genesis-custom-header', array( 'width' => 1140, 'height' => 150 ) );/** Reposition the secondary navigation */
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before', 'genesis_do_subnav' );/** Add after post ad section */
add_action( 'genesis_after_post_content', 'news_after_post_ad', 9 );
function news_after_post_ad() {
if ( is_single() && is_active_sidebar( 'after-post-ad' ) ) {
echo '<div class="after-post-ad">';
dynamic_sidebar( 'after-post-ad' );
echo '</div><!-- end .after-post-ad -->';
}
}/** Add after content ad section */
add_action( 'genesis_before_footer', 'news_after_content_ad' );
function news_after_content_ad() {
if ( is_active_sidebar( 'after-content-ad' ) ) {
echo '<div class="after-content-ad">';
dynamic_sidebar( 'after-content-ad' );
echo '</div><!-- end .after-content-ad -->';
}
}/** Add support for 3-column footer widgets */
add_theme_support( 'genesis-footer-widgets', 3 );/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'home-slider',
'name' => __( 'Home Slider', 'news' ),
'description' => __( 'This is the home slider', 'news' ),
) );
genesis_register_sidebar( array(
'id' => 'home-top',
'name' => __( 'Home Top', 'news' ),
'description' => __( 'This is the home top section.', 'news' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle-left',
'name' => __( 'Home Middle Left', 'news' ),
'description' => __( 'This is the home middle left section.', 'news' ),
) );
genesis_register_sidebar( array(
'id' => 'home-middle-right',
'name' => __( 'Home Middle Right', 'news' ),
'description' => __( 'This is the home middle right section.', 'news' ),
) );
genesis_register_sidebar( array(
'id' => 'home-bottom',
'name' => __( 'Home Bottom', 'news' ),
'description' => __( 'This is the home bottom section.', 'news' ),
) );
genesis_register_sidebar( array(
'id' => 'after-post-ad',
'name' => __( 'After Post Ad', 'news' ),
'description' => __( 'This is the after post ad section.', 'news' ),
) );
genesis_register_sidebar( array(
'id' => 'after-content-ad',
'name' => __( 'After Content Ad', 'news' ),
'description' => __( 'This is the after content ad section.', 'news' ),
) );January 31, 2013 at 1:42 pm #16812SoZoMemberYou need to move it out of the loop and instead put it into a function using the after_header or before_content_sidebar_wrap hook.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.