PluginProbe
Filter Everything — WordPress & WooCommerce Filters / trunk
Filter Everything — WordPress & WooCommerce Filters vtrunk
1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 All 51 releases
filter-everything / src / Admin / Widgets.php

Widgets.php in Filter Everything — WordPress & WooCommerce Filters trunk, at src/Admin/Widgets.php

37 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace FilterEverything\Filter;
5
6 if ( ! defined('ABSPATH') ) {
7 exit;
8 }
9
10 class Widgets
11 {
12 function __construct(){
13 add_action( 'widgets_init', array( $this, 'register' ) );
14 add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hideFromLegacyWidgetBlock' ) );
15 }
16
17 public function register(){
18 register_widget( '\FilterEverything\Filter\FiltersWidget' );
19 register_widget( '\FilterEverything\Filter\ChipsWidget' );
20 register_widget( '\FilterEverything\Filter\SortingWidget' );
21 }
22
23 /**
24 * Hides legacy widgets from the block-based widgets editor inserter and search,
25 * because they are replaced with Gutenberg-style blocks there.
26 * Already placed widget instances keep working and remain editable.
27 */
28 public function hideFromLegacyWidgetBlock( $widget_types ){
29 $widget_types[] = 'wpc_filters_widget';
30 $widget_types[] = 'wpc_chips_widget';
31 $widget_types[] = 'wpc_sorting_widget';
32
33 return $widget_types;
34 }
35 }
36
37 new Widgets();