• thatshortguy

    (@thatshortguy)


    Hey guys,

    I have a unique problem (or at least it seems to be since I can’t find a solution).

    I have this code in functions.php so I can put widgets in the footer of a theme I’m creating:

    if ( function_exists('register_sidebars') )
    	register_sidebars(4, array(
    	'name'=> __('Footer %d'),
    	'id' => "footer-$i",
    	'description' => __( 'Widgets will appear in the footer ' ),
    	'before_widget' => '<div id="%1$s" class="widget %2$s">',
    	'after_widget'  => '</div>',
    	'before_title'  => '<h1>',
    	'after_title'  => '</h1>'
    ));

    Now I want each div (widget) to use it’s own custom CSS (Footer 1 used the .footer-1 class and so on):

    .footer-1, .footer-2, .footer-3, .footer-4 {
    	float: left;
    	width: 200px;
    	height: 110px;
    	overflow: hidden;
    }
    
    .footer-2, .footer-3, .footer-4 {
     border-left: 1px solid #AAA;
     padding-left: 5px;
    }

    Is there a way to do this? Or do I need to break it up and use “register_sidebar()” instead?

Viewing 1 replies (of 1 total)
  • Thread Starter thatshortguy

    (@thatshortguy)

    I figured it out, although if there is no widgets to display it will be blank. This is in my footer.php:

    <div class="footer-1">
    <?php if ( !function_exists('dynamic_sidebar')
          || !dynamic_sidebar('footer-1') ) : ?>
         <?php endif; ?>
       </div>
    <div class="footer-2">
    <?php if ( !function_exists('dynamic_sidebar')
          || !dynamic_sidebar('footer-2') ) : ?>
         <?php endif; ?>
       </div>
    <div class="footer-3">
    <?php if ( !function_exists('dynamic_sidebar')
          || !dynamic_sidebar('footer-3') ) : ?>
         <?php endif; ?>
       </div>
     <div class="footer-4">
    <?php if ( !function_exists('dynamic_sidebar')
          || !dynamic_sidebar('footer-4') ) : ?>
         <?php endif; ?>
       </div>
Viewing 1 replies (of 1 total)

The topic ‘register_sidebars with custom CSS’ is closed to new replies.