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
- Why have on every line
- WordPress and event-driven programming – what is it about?
- Create Image Uploader for Widget
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- Displaying a variable stored in functions.php inside widget
- Custom Meta Field – Youtube embed
- Limit the Excerpt field in WP-Admin in words
- Print html when custom field has value inside while loop
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- Setting up widgets in wordpress with a unique ID for the after_title argument
- Count widgets of a certain type
- How to group 2 radio buttons in a widget?
- custom widget on the footer
- Sum custom field values of particular taxonomy
- Random Default Avatar Function
- Missing sidebar parameter “fix” – before_content
- Importing hard coded custom field into acf field
- Customizer: Output default value in Customizer CSS
- Taxonomy linked to pages
- Converting HTML Template to WordPress Theme
- Dynamic Sidebars & Echo
- Can I install/embed WordPress on a ‘single page’?
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- How can I add extra word in permalink when someone click download button?
- Seach custom post type posts only by meta fields?
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- conditional logic for front-end custom field edits
- Custom posts in different columns style
- Which PHP page is the Default Posts Page
- Non-Closing PHP Query in WordPress Loop
- How to show/hide php table rows based on the content of custom fields
- Add data-id attribute to child page links
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Display Youtube Time Automate from Key
- How to fix this PHP warning in WP-Admin after upgrading to 3.1.2?
- how to get serialized post meta
- Where is the PHP code generating an element?
- Basic wpdb update question
- How do i wrap woocomerce attribute in list?
- Conditional featured image with youtube thumbnail
- save metabox with new values _wp_page_template
- Show different website layout if no sidebar added
- pagination broken – clicking next displays “page not found”
- Display additional user fields
- Create condition for Author bio Social Links
- WP-Bakery – Add custom colors to buttons with template colors
- Add a “custom field” to a category that can be retrieved when viewing the category page with get_post_meta
- Woocommerce template file outputting tags
- How to Call on WordPress Custom Fields without a Plugin
- Dynamic Banner Text based on Subdomain
- Add widget area from visual editor
- Trying to retrieve meta values from three different meta keys and display in rows
- Create form which redirects to site in network?
- WP post meta – for loop inside for loop
- Search only for posts with specific metadata?
- Store custom field’s multiple values in one user meta key
- WooCommerce multiple custom fields code
- Dynamic_sidebar load in string makeup
- WP_query meta_query slow with OR and DATES
- meta field for numerous links
- Add disclaimer before certain posts and pages
- Is there a way to have chunks of a page’s content expire?
- How to list categories by page id in wordpress
- Where can I find the declaration of `$_wp_theme_features`?
- Static home page ignored
- How do I routinely extract the thumbnail of the most recent post?
- Showing the project type in HREF
- Display tab title as ‘blog tagline | blog title’
- divide custom field values in div every two values
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- WP_Widget dynamic field array with external AJAX
- How to exclude post from being queried based on custom meta value
- Check if values exists DB
- Name Input from widget displays Sidebar name instead of saved data
- WordPress – show number of comments for each post in widget
- Pagination on Custom Loop
- Select Menu for Custom post Type does not save
- How can I clear the theme mod settings?
- MySQL Engine vs. Charset
- How to define template directory in this widget code
- Search result page – display values from the result’s metaboxes
- Select area and checkbox data is not saving?
- What can I do to customize a widget provided with this plugin? from where have I to start?
- In reading settings posts are set to “blog” and I have page-blog.php but no posts
- Convert custom field date format to “WordPress default”
- How to execute a shortcode within a custom field?