/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//REGISTER SIDEBAR 'name' => 'Footer Area One', 'id' => 'sidebar-3', 'description' => 'An optional widget area for your site footer', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => "</aside>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); 'name' => 'Footer Area Two', 'id' => 'sidebar-4', 'description' => 'An optional widget area for your site footer', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => "</aside>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); 'name' => 'Footer Area Three', 'id' => 'sidebar-5', 'description' => 'An optional widget area for your site footer', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => "</aside>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); //COUND THE NUMBER OF FOOTER SIDEBARS TO ENABLE DYNAMIC CLASSES FOR THE FOOTER function custom_footer_sidebar_class() { $count = 0; if ( is_active_sidebar( 'sidebar-3' ) ) $count++; if ( is_active_sidebar( 'sidebar-4' ) ) $count++; if ( is_active_sidebar( 'sidebar-5' ) ) $count++; $class = ''; switch ( $count ) { case '1': $class = 'one'; break; case '2': $class = 'two'; break; case '3': $class = 'three'; break; } if ( $class ) echo 'class="' . $class . '"'; }