Support » Themes and Templates » Sidebar widgets with different class names

  • I’m trying to have my widgets to have it’s own separate class (using the example here) but instead of getting a different class for each (ex: widget-1, widget-2, etc…) I get <div class='widget- %2$s'

    What am I doing wrong?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • what is your exact code?

    seems like you are using single quotes;
    try to work with double quotes as in the example.

    Thread Starter fusionPT

    (@fusionpt)

    Tried changing the quotes, still doesnt work. Here the code:

    $args = array(
    	'name'          => __( 'Sidebar acudame', 'acudame.org' ),
    	'id'            => 'unique-sidebar-id',
    	'description'   => '',
        'class'         => '',
    	'before_widget' => '<div class="sidebox">',
    	'after_widget'  => '</div>',
    	'before_title'  => '<h3 class="widget %2$s">',
    	'after_title'   => '</h3>' ); 
    
    register_sidebar( $args );

    the %2$s only works on the 'before_widget' parameter.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sidebar widgets with different class names’ is closed to new replies.