Code snippet only applying to sidebar widgets and not footer widgets
-
I have this code snippet (used via the Code Snippets plugin):
function add_widget_name_id($params) { $params[0]['before_title'] = '<h2 id="' . $params[0]['widget_name'] . '" class="widget-title">' ; return $params; } add_filter('dynamic_sidebar_params', 'add_widget_name_id');
This amends widget h2 tags so that they include the widget title as an id attribute e.g. Widget is called “Rainbow” so h2 tag is output as
<h2 id="Rainbow" class="widget-title">Rainbow</h2>
However, this is only working for widgets in the Sidebar and not widgets in the Footer area.
Screenshot of widget in sidebar with correct id attribute: imgur.com/OOjXIGc
Screenshot of widget in footer that is missing the id: imgur.com/MUleedvWhat do I need to change so that this code is also applied to widgets in the footer?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Code snippet only applying to sidebar widgets and not footer widgets’ is closed to new replies.