Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Create ACF field called `widget_class` and assign to all widgets to use this function
- add_filter('dynamic_sidebar_params', 'my_dynamic_sidebar_params');
- function my_dynamic_sidebar_params($params)
- {
- if ($params[0]['id'] != 'footer') return $params;
- $widget_id = $params[0]['widget_id'];
- $classes = get_field('widget_class', 'widget_' . $widget_id);
- if ($classes) {
- $params[0]['before_widget'] = str_replace('col-xs-12', $classes, $params[0]['before_widget']);
- }
- return $params;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement