How to save widget fields generated from an array?

OK, so I’ve done some debugging and I know where your problem lies… First of all in update function: public function update( $new_instance, $old_instance ) { $instance = $old_instance; if ( empty( $this->fields ) ) { return $instance; } $instance = $this->save_fields( $new_instance, $old_instance ); return $instance; } You shouldn’t use $old_instance as starting point. … Read more

How to allow your custom widget as block in gutemberg editor

I found the solution here and here. My OOP Code : Block_Type abstract Class Block_Type { public $handle; public $handle_editor; public $handle_block; private $editor_js_file; public $editor_js_file_path; private $editor_css_file; public $editor_css_file_path; private $css_file; public $css_file_path; public function __construct( $handle, $editor_js_file_path = null, $editor_css_file_path = null, $css_file_path = null ) { $this->handle = “h4a-” . $handle; $this->handle_editor … Read more

Prev / Next menu item

I wrote this short-code plugin. To use it add the following shortcode to any page or inside a shortcode widget. [menu_navigator menu=’The name of your menu’] menu will default to “Table of contents” if not specified. To install, just save to a file named shortcode-blazoruniversity-menu-navigator.php, zip it up, and then upload it as a plugin. … Read more

Adding widget to dashboard with wp_dashboard_setup not working

Use this code to require the file from your theme’s functions.php file: require get_template_directory() . ‘includes/dashboard.php’; For the sake of completeness (and sanity) my dashboard.php file lives here: my-theme/includes/dashboard.php I took a closer look at the original issue, and I think what’s happening is that the require statement is silently failing because the wp-admin/includes/dashboard.php file … Read more

Is there any way to print a widget by having its id?

One way to do this would be to filter out all the other widgets in the sidebar while calling the dynamic_sidebar output. Updated to take widget index OR ID slug function custom_output_widget( $sidebar_id, $widget_id ) { global $custom_widget_target; // if ( !$sidebar_id ) { // $sidebars_widgets = get_option( ‘sidebars_widgets’ ); // print_r( $sidebars_widgets ); return; … Read more

How often does the RSS widget get updates?

RSS widget uses fetch_feed() function, which is setting default cache lifetime to 43200 seconds (12 hours). Since this value is filtered it can be overridden (as can feed cache overall). I did encounter plugin once, whose developer citing performance reasons completely disabled feed caching for all feeds.