Class for the tag cloud widget
-
I would like to change the margin of the div that contains the tag cloud in my tag cloud widget.
the tag cloud widget markup looks like this:<li class="widget"> <h4>widget title</h4> <div> the tags are here </div> </li>The problem with this markup is the div that contains the tags, wich has no id or class for me to point css at it!
I have to create a general css rule for it and then specify other rules to correct all of the other widgets. So how can i have a class for this specific tags div?
-
You need to edit the theme’s functions.php so that it adds appropriate classes & ids to each of your widgets.
http://codex.ww.wp.xz.cn/Function_Reference/register_sidebar
I´m already registering the sidebar widgets, i´m putting li class=”widget” and /li to each widget, and the title goes with h4 tags. The problem is just with the tag cloud widget, specifically with the div it uses to contain the tags. As it is generated by the widget, it comes with no class, wich is a bit of a problem
http://codex.ww.wp.xz.cn/Function_Reference/register_sidebar
check particular this line:
'before_widget' => '<li id="%1$s" class="widget %2$s">',this
%2$swill generate a distinct class for each widget.Thanks Alchymyth! Didn´t know those expressions could generate that! Too bad it´s not clearly mentioned in the codex! (or maybe i´m overseeing it).
That got my issue fixed!Very useful, but I have a question: how can i get the exact class of the tag cloud and put it in my css?
The topic ‘Class for the tag cloud widget’ is closed to new replies.