Skip to content

Commit

Permalink
Fix editing widgets in a block theme
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Feb 19, 2025
1 parent bb6d04d commit 53713d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions friends.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
add_action( 'wp_initialize_site', array( __NAMESPACE__ . '\Friends', 'activate_for_blog' ) );

// Register widgets.
add_filter( 'customize_loaded_components', array( __NAMESPACE__ . '\Frontend', 'ensure_widget_editing' ) );

require_once __DIR__ . '/widgets/class-widget-base-friends-list.php';
require_once __DIR__ . '/widgets/class-widget-refresh.php';
add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Refresh', 'register' ) );
Expand Down
3 changes: 1 addition & 2 deletions includes/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ private function register_hooks() {
add_action( 'wp_untrash_post_status', array( $this, 'untrash_post_status' ), 10, 2 );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_action( 'template_redirect', array( $this, 'load_theme' ) );
add_action( 'customize_loaded_components', array( $this, 'ensure_widget_editing' ) );
add_action( 'friends_load_theme_default', array( $this, 'default_theme' ) );
add_action( 'friends_template_paths', array( $this, 'friends_template_paths' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'dequeue_scripts' ), 99999 );
Expand Down Expand Up @@ -242,7 +241,7 @@ public function register_friends_sidebar() {
}
}

public function ensure_widget_editing( $components ) {
public static function ensure_widget_editing( $components ) {
if ( ! is_array( $components ) ) {
$components = array();
}
Expand Down

0 comments on commit 53713d8

Please sign in to comment.