I eventually use the following to be able to do it:
add_filter('dynamic_sidebar_params', function($params) {
global $wp_registered_widgets;
$this_widget_id = $params[0]['widget_id'];
$this_widget = $wp_registered_widgets[$this_widget_id];
$widget_object = $this_widget['callback'][0];
$all_settings = get_option($widget_object->option_name);
$saved_settings = $all_settings[$params[1]['number']];
if ($saved_settings['myclass']) {
$classe_to_add = 'myclass ';
$classe_to_add = 'class=" '.$classe_to_add;
$params[0]['before_widget'] = str_replace('class="',$classe_to_add,$params[0]['before_widget']);
}
return $params;
});
Related Posts:
- Infinite-Scroll Plugin and Jetpack Infinite Scroll Plugin – Adding to “Thoughts” Theme
- Widgets not showing in my custom theme
- How to add just one specific page to widget without plugin?
- Extending the WP_Widget_Text class
- Saving and Restoring a Canvas on A Individual User Basis
- Hook called before text widget save
- WordPress widget and customize.php not working in Ubuntu16.04 VPS
- Display movies that apear this day next
- How can I add diffrent editable text fields?
- Trying to update Woocommerce meta values
- Showing custom field contents without listing description
- Widget header unique classes
- Where can I find the code for the menu page meta boxes?
- Edit the Publish Widget Options
- fetch from an external api call and display results in page
- wordpress-plugin (widget) that performs a Neaby-search on the openstreetmap-endpoint: around x find y
- Displaying theme options in css
- Custom field value not saving when it contains a URL?
- Creating bulk posts with Youtube videos
- Sum custom field values of particular taxonomy
- Random Default Avatar Function
- Missing sidebar parameter “fix” – before_content
- Hide wordpress field if data is empty in post!
- Importing hard coded custom field into acf field
- Change the site tagline (or similar) based on current page
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- Setting custom canonical urls
- tracking number field in Woocommerce order [closed]
- Only show search results with if current date is between two dates?
- database interactions using OOP
- Customizer: Output default value in Customizer CSS
- Remove one value in dismissed_wp_pointers?
- create a select input with menus created on a custom options page
- Taxonomy linked to pages
- Create onClick Event to Re-load a Widget
- How to put a variable in a instance in the widget
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- How can I create a list of page titles from custom meta values?
- How to output widget
- Accessing data from a non-WP database/table within a page content
- Passing the custom field values in the wp_get_current_user array function
- WordPress blog post url on category page
- Changing layout with wp_customise
- WP dynamic featured image – Can’t get second featured image url
- Converting HTML Template to WordPress Theme
- Sort posts by custom fields value using dropdown menu
- Custom profile field with birthday. Troubles with
- Dynamic Sidebars & Echo
- Selectbox in admin panel function linking to CSS
- Can I install/embed WordPress on a ‘single page’?
- WordPress – Display array data of a child
- wordpress allow user to edit user profile with custom fields
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- How to check if a meta value has already been assigned to any user?
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- filter default query to show just selected level of child pages in wordpress
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Store multiple custom field as post meta per post(css, js, html, 2 link) [closed]
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Trying to build simple deposit code that hooks into woocommerce
- Need Help Fixing My Iframes [closed]
- How to pick the default selected value in wordpress dropdown?
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- Firing schema via code in functions.php doesn’t work
- Add New User, extra fields which are required?
- user_profile_update_errors hook not executing
- Adding number to date not working [closed]
- Send an email to specific adress when button is clicked?
- How to make my custom widget appear within WordPress widgets? Plugin development
- How can I add extra word in permalink when someone click download button?
- get widget number from array dynamically
- Customizer: active_callback and sanitize_callback incompatibility?
- Redirect specific user role to specific site after login?
- Send multiple attachments with wp_mail in PHP
- WordPress admin pointers tour bug?
- Adding widgets to my plugin page instead of WordPress dashboard
- Seach custom post type posts only by meta fields?
- custom url rewrite for wordpress
- Extend plugin Class through functions.php
- How to use thumbnail size of image if I’m only using src to get image
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- How to add a do_action on refreshing of WP customizer?
- how to retrieve a value if a checkbox is checked
- Customize position of social icons in upme plugin [closed]
- Weird 404 URL Problem – domain name being placed at end of urls
- Trouble checking if custom woocommerce checkout field is empty or not
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Hide subcategories (widget)
- How to get the value of input hidden html from text editor to custom page template?
- Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
- Menu jumping when calling it via PHP
- Why my image upload button is not working in wordpress widget area?
- Output Video Download Link in template
- Modify custom field input data before creating a new post
- Adding a widget function into the php theme file
- auto-populating custom nav with all items from custom post type
- Output custom field value to post string
- How to edit widget code to add unique class name to each div?
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value