Forums

[resolved] Widgets has no id or class (4 posts)

  1. Dalixam
    Member
    Posted 4 months ago #

    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?

  2. t31os_
    Member
    Posted 4 months ago #

    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>',
        ));
    }
  3. Dalixam
    Member
    Posted 4 months ago #

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

  4. 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 :)

  • t31os_
    Member
    Posted 4 months ago #

    Happy to help... ;)

  • Reply

    You must log in to post.

    About this Topic

    Tags