Snippets: Add a 6th Column to the Footer Widget Columns

// Hook into Customizer to allow for 6 column selection in Footer Widgets
add_filter( 'wpex_customizer_sections', function( $sections ) {

	// Add new setting under the header > logo section
	$sections['wpex_footer_widgets_columns']['settings']['footer_widgets_columns']['control']['choices'] = array(
		'6' => '6',
		'5' => '5',
		'4' => '4',
		'3' => '3',
		'2' => '2',
		'1' => '1',
	);

	// Return settings
	return $sections;

} );

// Register new footer column widget area
add_action( 'widgets_init', function() {
	$tag = wpex_get_mod( 'footer_headings' );
	$tag = $tag ? $tag : 'div';
	register_sidebar( array(
			'name'          => __( 'Footer Column 6', 'total' ),
			'id'            => 'footer_six',
			'before_widget' => '<div id="%1$s" class="footer-widget widget %2$s clr">',
			'after_widget'  => '</div>',
			'before_title'  => '<' . $tag . ' class="widget-title">',
			'after_title'   => '</' . $tag . '>',
		) );
}, 50 );

// Add extra footer widget area
add_action( 'wpex_hook_footer_widgets_bottom', function() {
	$columns    = wpex_get_mod( 'footer_widgets_columns', '4' );
	$grid_class = apply_filters( 'wpex_footer_widget_col_classes', wpex_grid_class( $columns ) );

	if ( '6' == $columns ) { ?>

		<div class="footer-box <?php echo esc_attr( $grid_class ); ?> col col-6">
			<?php dynamic_sidebar( 'footer_six' ); ?>
		</div><!-- .footer-box -->

	<?php } ?>

<?php } );

Snippet Type: PHP

Posted Under: Footer

All PHP snippets should be added via a child theme's functions.php file.