WordPress.org

Ready to get started?Download WordPress

Forums

Widget Exceptions (2 posts)

  1. designcarter
    Member
    Posted 5 years ago #

    Have a strange need on a project I'm working with.

    In the functions.php form I have special styling/enclosure for the sidebar widgets:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'before_widget' => '<div class="myclass">',
    'after_widget' => '</div>',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>',
    ));
    ?>

    So I have a Widget that I'm using on all pages in the same sidebar section. The difference is that I want to use a different enclosure around that specific widget. How can I do a conditional using the widget name, or what are my options?

    Example that I'd change it to would be:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'before_widget' => '<div class="myclass2">',
    'after_widget' => '</div>',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>',
    ));
    ?>

  2. Valerie
    Member
    Posted 5 years ago #

    I would like to know this, too!

Topic Closed

This topic has been closed to new replies.

About this Topic