Community Forums › Forums › Archived Forums › Design Tips and Tricks › Include after_entry widget area in the site-container structural area
Tagged: After Entry, container, genesis_structural_wrap, wrap
- This topic has 1 reply, 1 voice, and was last updated 9 years, 10 months ago by
EZEarache.
-
AuthorPosts
-
April 14, 2015 at 9:04 pm #147958
EZEarache
MemberHi,
I am trying to get two custom widget areas to wrap in the site-container so they align next to each other.
I just discovered the genesis_structural_wrap function.
I'm using the following code on my site, but it wraps them in separate containers. How do I get them in the same container?
http://kayakwappingers.com/awayadventures///* Add support for structural wraps so that widget areas can be placed into the home page add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'site-inner', 'footer-widgets', 'footer', 'events-widget', 'contact-widget' ) ); //* Contact Widget genesis_register_sidebar( array( 'id' => 'contact-widget', 'name' => __( 'Contact Widget', 'genesis' ), 'description' => __( 'Contains Contact Information under the Content Area' ), ) ); add_action( 'genesis_after_entry', 'add_genesis_widget_area' ); function add_genesis_widget_area() { if ( is_page('006') && is_active_sidebar('contact-widget') ) { genesis_structural_wrap( 'contact-widget' );//Puts the Event's Widget in the container genesis_widget_area( 'contact-widget', array( 'before' => '<div id="contact-widget">', 'after' => '</div>', ) ); genesis_structural_wrap( 'contact-widget', 'close' ); } } //* Events Widget genesis_register_sidebar( array( 'id' => 'events-widget', 'name' => __( 'Events Widget for Home Page', 'genesis' ), 'description' => __( 'Contains Events Widget under the Content Area' ), ) ); add_action( 'genesis_after_entry', 'add_genesis_events_widget' ); function add_genesis_events_widget() { if ( is_page('006') && is_active_sidebar('events-widget') ) { genesis_structural_wrap( 'events-widget' );//Puts the Event's Widget in the container genesis_widget_area( 'events-widget', array( 'before' => '<div id="events-widget">', 'after' => '</div><div class="clear-widget"></div>',//* Ends Home Widget Container ) ); genesis_structural_wrap( 'events-widget', 'close' ); } }
April 16, 2015 at 6:44 pm #148166EZEarache
MemberO.K. So this is resolved.
The proper way to do this is not so much with a Genesis Structural Wrap as I originally thought. The correct way to do this is with an echo function which then wraps the two widget areas in your functions.php file like so:
//* Contact Widget genesis_register_sidebar( array( 'id' => 'contact-widget', 'name' => __( 'Contact Widget', 'genesis' ), 'description' => __( 'Contains Contact Information under the Content Area' ), ) ); //* Events Widget genesis_register_sidebar( array( 'id' => 'events-widget', 'name' => __( 'Events Widget for Home Page', 'genesis' ), 'description' => __( 'Contains Events Widget under the Content Area' ), ) ); add_action( 'genesis_after_entry', 'add_genesis_widget_area' ); function add_genesis_widget_area() { if ( is_page('006') && is_active_sidebar('contact-widget') ) { echo '<div class="two-widget-container">'; //This Opens the widget-container genesis_widget_area( 'contact-widget', array( 'before' => '<div class="contact-widget-wrapper one-half first">', 'after' => '</div>', ) ); genesis_widget_area( 'events-widget', array( 'before' => '<div class="events-widget-wrapper one-half">', 'after' => '</div>',// Ends Home Widget Container ) ); echo '</div>'; //Closes the widget-container } }
I would like to thank Sure Fire Web for showing me the light here. Now I understand echo Whoop Whoop!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.