• Resolved Dalixam

    (@dalixam)


    Hi,

    I want to style each widget individually, but they have no class or id. I use a template I made from scratch, but the widgets are added with drag-n-drop in the admin section, they are not hard coded.

    When I look at the source with my own design it just says ‘<h2>Archives</h2>’ for instance, but when I turn on the default design it is ‘<li id=”archives-3″ class=”widget widget_archive”><h2 class=”widgettitle”>Archives</h2>’.

    What am I missing for the widgets to get a class?

Viewing 3 replies - 1 through 3 (of 3 total)
  • As a guess, you’re missing… or something to that degree..

    if ( function_exists('register_sidebar') ) {
        register_sidebar(array(
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget' => '</li>',
            'before_title' => '<h2 class="widgettitle">',
            'after_title' => '</h2>',
        ));
    }
    Thread Starter Dalixam

    (@dalixam)

    I feel stupid… I do have that function (otherwise widgets drag’n’drop wouldn’t work), but I removed the

    • and <h2> a while ago because I didn’t like the look and I forgot about it.
    • I’m a dumbass, but thanks for helping 🙂

    Happy to help… 😉

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Widgets has no id or class’ is closed to new replies.