/ Published in: PHP

How to put sidebars footer on twenty twelve theme again. Part 4: Insert a new function (retouched from twentyeleven) in the functions.php file.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * 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 . '"'; }
Comments
