Forums

Widgets: Del.icio.us Widget: Adding 'class' (2 posts)

  1. HaiPunk
    Member
    Posted 3 years ago #

    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)

  2. Otto42
    Moderator
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic