• Hey!

    I’m using WordPress Widgets with the del.icio.us Widget. Every <ul> element in my sidebar has a class, something like class=’icon comment’ which adds an nice comment-icon at every <li>.

    I also want to to use these class-elements at my del.icio.us-linklist, but there is only this code in the .php-file:

    var ul = document.createElement('ul');

    Can someone help me how to add the class-element here?

    Link:
    Wordpress Widgets: http://automattic.com/code/widgets/ (includes del.icio.us Widget)

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    ww.wp.xz.cn Admin

    Look lower. The delicious widget UL gets an ID of “delicious-list” via this bit of PHP code:
    ul.setAttribute('id', 'delicious-list');

    If you really want to set a class on it, you can do this just after that:
    ul.setAttribute('class', 'your_class');
    Or whatever you prefer.

    Alternatively, given that it already has an ID, you can add that ID to your existing CSS and thus style it directly. This would be best as it doesn’t involve changing the code, so if you upgrade the widget later, you don’t have to hack the code again. Just add “#delicious-list” to the given chunk of CSS code that does the icon thing.

Viewing 1 replies (of 1 total)

The topic ‘Widgets: Del.icio.us Widget: Adding ‘class’’ is closed to new replies.