Community Forums › Forums › Archived Forums › General Discussion › after_content widget area not wrapping in site-container
Tagged: genesis_after_content, site container
- This topic has 8 replies, 2 voices, and was last updated 9 years, 8 months ago by Pixel Frau.
-
AuthorPosts
-
April 11, 2015 at 8:07 am #147484EZEaracheMember
Hi,
I am trying to add a few widget areas below the main content area, but they aren't wrapping in "site-container". They are just displaying above the footer area and also causing the footer area to go full width, which I don't want. Is this the way the after_content widget area is supposed to behave or did I do something wrong? Is there a way to get it to wrap in the "site-container"?
I'm using the following code in functions:
//* Creates a Widget for the Contact area
genesis_register_sidebar( array(
'id' => 'contact-widget',
'name' => __( 'Contact Widget', 'genesis' ),
'description' => __( 'Contains Contact Information under the Content Area' ),
) );add_action( 'genesis_after_content', 'add_genesis_widget_area' );
function add_genesis_widget_area() {
if ( is_page('006') && is_active_sidebar('contact-widget') ) {
genesis_widget_area( 'contact-widget', array(
'before' => '<div class="contact-widget widget-area">',
'after' => '</div>',
) );
}
}April 11, 2015 at 8:38 am #147490Pixel FrauMemberWhich theme are you using? Link to the site?
April 11, 2015 at 9:00 am #147495EZEaracheMemberHi Julia,
Thanks for your response.
I'm creating a custom Genesis Child Theme.
I've played around with it some more so the function I'm using at the moment is:
//* Creates a Widget for the Contact area
genesis_register_sidebar( array(
'id' => 'contact-widget',
'name' => __( 'Contact Widget', 'genesis' ),
'description' => __( 'Contains Contact Information under the Content Area' ),
) );add_action( 'genesis_entry_footer', 'add_genesis_widget_area' );
function add_genesis_widget_area() {
if ( is_page('006') && is_active_sidebar('contact-widget') ) {
genesis_widget_area( 'contact-widget', array(
'before' => '<div id="contact-widget">',
'after' => '</div>',
) );
}
}I've been styling it with:
#contact-widget {
max-width: 970px;
max-height: 510px;
position:relative;
margin: 0 auto 0 auto;
}#text-2.widget.widget_text {
display: block;
position: relative;
float: left;
max-width: 450px;
max-height: 500px;
border: 20px solid transparent;
border-radius: 40px 40px 40px 40px;
background-color: #C7B299;
-webkit-box-shadow: 3px 15px 43px 3px rgba(0,0,0,0.8);
-moz-box-shadow: 3px 15px 43px 3px rgba(0,0,0,0.8);
box-shadow: 3px 15px 43px 3px rgba(0,0,0,0.8);
-webkit-border-image: url(http://www.kayakwappingers.com/awayadventures/wp-content/themes/genesis-sample/images/content-border.png) 30 30 30 30;
-o-border-image: url(http://www.kayakwappingers.com/awayadventures/wp-content/themes/genesis-sample/images/content-border.png)30 30 30 30;
border-image: url(http://www.kayakwappingers.com/awayadventures/wp-content/themes/genesis-sample/images/content-border.png) 30 30 30 30;
padding: 10px;
margin: 0px auto 0px auto;
overflow: hidden;}
The float left is what's making it go into the footer, but I would really like the whole widget to get wrapped by site-container.
April 11, 2015 at 9:19 am #147500EZEaracheMemberSeems like my link didn't work before.
April 11, 2015 at 9:53 am #147511Pixel FrauMemberOK, how do you want it to look? Left aligned, below the content and above the footer? Is there a particular reason you need a custom widget area rather than using the built-in Genesis footer widgets?
Sorry for all the questions, but it helps see what might be the best solution for you. 🙂
April 11, 2015 at 10:09 am #147515EZEaracheMemberHi,
Yes, I want it left aligned, below the content and above the footer. I assumed that the footer widgets would go into the footer. So I figured I needed a custom widget. Is that not the case, Also, the widget areas I'm creating will only be visible on the home page. I'm also guessing that the footer widgets would be global across the site. Maybe my assumptions are incorrect.
Your help is greatly appreciated, so I'm happy to answer your questions.
April 11, 2015 at 10:18 am #147516Pixel FrauMemberThe footer widgets have their own section above the credits.
An easy solution would be to add a div after the widget area, then clear the float in the CSS.
So your widget area function would look something like this:
//* Creates a Widget for the Contact area genesis_register_sidebar( array( 'id' => 'contact-widget', 'name' => __( 'Contact Widget', 'genesis' ), 'description' => __( 'Contains Contact Information under the Content Area' ), ) ); add_action( 'genesis_entry_footer', 'add_genesis_widget_area' ); function add_genesis_widget_area() { if ( is_page('006') && is_active_sidebar('contact-widget') ) { genesis_widget_area( 'contact-widget', array( 'before' => '<div id="contact-widget">', 'after' => '</div><div class="clear"></div>', ) ); } }
And you'd add this to your CSS:
.clear { clear: both; }
April 11, 2015 at 10:45 am #147521EZEaracheMemberCool Thanks!
That seems to fix the problem for now.
I take it there's no way to get this to go into the "site-container" that you cab think of though?
April 11, 2015 at 10:48 am #147522Pixel FrauMemberYou could try using a different hook. Check out the visual hook guide and plugin.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.