Problems with the sidebar args and wp_list_bookmarks

After a few var_dumps I know this:

1) When wp_list_bookmarks is called whithin WP_Widget_Links->widget
The 'class' parameter is ignored because the 'category_before' parameter
doesn’t have the %class wildcard. Instead 'category_before' will
look as if ‘class’ where 'widget_links'.

This is how the function dynamic_sidebar set the $before_widget parameters
for the widget once it gets called.

Of course this can be altered by filters like 'widget_links_args' or 'dynamic_sidebar_params'.

2) On many themes in order to present default widgets the wp_list_bookmarks is called
but with zero parameters then the default values are used as defined in bookmark-template.php:

('class' => 'linkcat','category_before' => '<li id="%id" class="%class">')

and this happen even when the sidebar is registered using:

('before_widget' => '<li id="%1$s" class="widget %2$s">')

which can let to a little inconsistence because WP_Widget_Links
'category_before' parameter is initially borrow from sidebar 'before_widget'
parameter.

Leave a Comment