Return to Snippet

Revision: 63861
at June 13, 2013 11:06 by almendro


Initial Code
/**
 * Count the number of footer sidebars to enable dynamic classes for the footer
 
 Ported from twentyeleven by Martin Ochoa 2013-06-12
 */
function twentytwelve_footer_sidebar_class() {
	$count = 0;

	if ( is_active_sidebar( 'sidebar-4' ) )
		$count++;

	if ( is_active_sidebar( 'sidebar-5' ) )
		$count++;

	if ( is_active_sidebar( 'sidebar-6' ) )
		$count++;

	$class = '';

	switch ( $count ) {
		case '1':
			$class = 'one';
			break;
		case '2':
			$class = 'two';
			break;
		case '3':
			$class = 'three';
			break;
	}

	if ( $class )
		echo 'class="' . $class . '"';
}

Initial URL

                                

Initial Description
How to put sidebars footer on twenty twelve theme again. Part 4: Insert a new function (retouched from twentyeleven) in the functions.php file.

Initial Title
WP twentytwelve theme width sidebar footer again. Part 4: FUNCTIONS.PHP (again)

Initial Tags
wordpress

Initial Language
PHP