Adding custom field in all widgets, but at the top of the form, in admin area
Adding custom field in all widgets, but at the top of the form, in admin area
Adding custom field in all widgets, but at the top of the form, in admin area
Actually these types of task is for plugin not for widget. Based on the value of widget instance scripts can be enqueued to footer not in head or just after body tag. Reason behind this is the instance value can be checked inside the function widget of widget class. The function widget is called when … Read more
Save Widget State Between Theme Swaps?
In case anyone is interested, I’m answering my question: The blocks parameter in the transform code should be [ ‘core/legacy-widget’ ] instead of [ ‘my/custom-block’ ]. For a from transform it indicates the block(s) you want to transform from, which in this case is a legacy widget.
Is there any way to parse blocks inside widget area?
Issue #1 (nested tax_query with OR relation) After going through WordPress core and WooCommerce core, it appears query_type_bag-type=or (query_type_.$attribute) query arg is only changing the value of the operator key on the individual taxonomy array for the attribute. For example: query_type_pa_color=and = operator => ‘AND’ query_type_pa_color=or = operator => ‘IN’ You can see in the … Read more
How to check if a WordPress core block is active in sidebar
If the goal is to display the block ID so that the user can get it easily, instead try using a block editor filter to add a panel in the sidebar: From: https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#editor-blockedit const { createHigherOrderComponent } = wp.compose; const { Fragment } = wp.element; const { InspectorControls } = wp.blockEditor; const { PanelBody } … Read more
I would do: function update($new_instance, $old_instance) { … $instance[‘show_photostream’] = $new_instance[‘show_photostream’]; return $instance; } function form($instance) { $defaults = array ( … ‘show_photostream’ => !empty( $instance[‘show_photostream’] ) ? $instance[‘show_photostream’] : false ); $instance = wp_parse_args( (array) $instance, $defaults);
I had the same problem when adding tinymce to widgets a few months ago. Add all your javascript code with enqueue script, instead of adding it in each widget instance. Here is my tinymce implementation: http://gist.github.com/600616