Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to: add additional container inside wrap
- This topic has 5 replies, 2 voices, and was last updated 7 years, 8 months ago by Victor Font.
-
AuthorPosts
-
January 14, 2017 at 9:57 am #199379mmjaegerMember
Hello
Genesis basically creates the following markup for the footer-widgets - how could I place an additional container right after the 'wrap' container in order to get from here:<div class="footer-widgets" id="genesis-footer-widgets"> <div class="wrap"> <div class="footer-widgets-1 widget-area"> ... </div> </div> </div>
to something like this:
<div class="footer-widgets" id="genesis-footer-widgets"> <div class="wrap"> <div class="wrap-inner"> <div class="footer-widgets-1 widget-area"> ... </div> </div> </div> </div>
thank you in advance for your help
January 14, 2017 at 10:43 am #199380Victor FontModeratorThe only way I can see is if you create your own function. If you look at Genesis/lib/structure/footer.php, you'll find a function called genesis_footer_widget_areas(). You would need to copy this function into functions.php and modify it for your needs. Since it's a little complicated, so I've done it for you. If you add the following to your functions file, you'll have what you want:
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' ); add_action( 'genesis_before_footer', 'my_genesis_footer_widget_areas' ); function my_genesis_footer_widget_areas() { $footer_widgets = get_theme_support( 'genesis-footer-widgets' ); if ( ! $footer_widgets || ! isset( $footer_widgets[0] ) || ! is_numeric( $footer_widgets[0] ) ) return; $footer_widgets = (int) $footer_widgets[0]; // Check to see if first widget area has widgets. If not, do nothing. No need to check all footer widget areas. if ( ! is_active_sidebar( 'footer-1' ) ) return; $inside = ''; $output = ''; $counter = 1; while ( $counter <= $footer_widgets ) { // Darn you, WordPress! Gotta output buffer. ob_start(); dynamic_sidebar( 'footer-' . $counter ); $widgets = ob_get_clean(); if ( $widgets ) { $inside .= sprintf( '<div class="footer-widgets-%d widget-area">%s</div>', $counter, $widgets ); } $counter++; } if ( $inside ) { $_inside = genesis_structural_wrap( 'footer-widgets', 'open', 0 ); $_inside .= '<div class="wrap-inner">' . $inside ; $_inside .= genesis_structural_wrap( 'footer-widgets', 'close', 0 ); $output .= genesis_markup( array( 'open' => '<div %s>' . genesis_sidebar_title( 'Footer' ), 'close' => '</div></div>', 'content' => $_inside, 'context' => 'footer-widgets', 'echo' => false, ) ); } echo apply_filters( 'genesis_footer_widget_areas', $output, $footer_widgets ); }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 14, 2017 at 11:24 am #199388mmjaegerMemberThis reply has been marked as private.January 14, 2017 at 12:35 pm #199394Victor FontModeratorNo one except forum moderators can see private posts. If you were responding to my previous post, you need to make it public otherwise nobody can see it.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 14, 2017 at 12:38 pm #199395mmjaegerMemberThanks Victor - you're really an asset to this community.
Meanwhile I figured it out - please see below:add_filter( 'genesis_structural_wrap-footer-widgets', 'prefix_filter_footer_widgets_structural_wrap', 10, 2); function prefix_filter_footer_widgets_structural_wrap( $output, $original_output ) { if ( 'open' == $original_output ) $output .= '<div class="wrap-inner">'; elseif ( 'close' == $original_output ) $output .= '</div>'; return $output; }
January 14, 2017 at 1:06 pm #199396Victor FontModeratorGood find! I missed that one.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.