Skip to content

Snippet: Different Footer Widget Columns on Mobile

/**
 * Add responsive grid classes to your footer columns
 * Note: Only add the classes you need. For example if the default columns
 * are set to 4 no need to define 4 columns again for tablet devices.
 *
 * All responsive column classes use the format span_1_of_{columns}_{device}
 * Devices: tl => tablet landscape ( max-width: 1024px )
 *			tp => tablet portrait ( max-width: 959px )
 *			pl => phone landscape ( max-width: 767px )
 *			pp => phone portrait ( max-width: 479px )
 *
 */
add_filter( 'wpex_footer_widget_col_classes', function ( $classes, $class = '', $post_id = '' ) {

	// 4 columns on tablet landscape
	$classes[] = 'span_1_of_4_tl';

	// 3 columns on table portrait
	$classes[] = 'span_1_of_3_tp';

	// 2 Columns on phone landscape
	$classes[] = 'span_1_of_2_pl';

	// 2 Column on phone portrait
	$classes[] = 'span_1_of_2_pp';

	return $classes;

}, 50, 3 );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top