Forums

What is best way to modify this Function for widgets? (3 posts)

  1. mibsolutionsllc
    Member
    Posted 2 years ago #

    I understand the below function for WordPress widgets below,

    register_sidebar(array(
    'name' => 'sidebar',
    'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widgetTop"></div>',
    'after_widget' => '</div>',
    'before_title' => '<h2 class="accordion_toggle">',
    'after_title' => '</h2>',
    ));

    as 'before_title' and 'after_title' are my H2 titles of the widget, and the 'before_widget' and 'after_widget' encases the widget itself. But what if I need to put a class inside the widget, instead of outside? I want all content inside the widget to have a certain class. What would the correct syntax be for this? 'inside_widget'?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    You can't just add parameters to register_sidebars, as far as I'm aware. If you need to add a class inside the widget, use something like:

    register_sidebar(array(
    'name' => 'sidebar',
    'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widgetTop"></div>',
    'after_widget' => '</div></div>',
    'before_title' => '<div class="inner-widget"><h2 class="accordion_toggle">',
    'after_title' => '</h2>',
    ));
  3. MichaelH
    Volunteer
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic