Skip to content

Commit

Permalink
SNOW-15: Fixed WP error from adding panel widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkbulecount2 committed Feb 9, 2018
1 parent bbdd6dc commit cd5cb42
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@ public function widget( $args ) {

/* Register and initialise all panels in $snow_panels */
foreach ($snow_panels as $panel) {
register_widget( new snow_panel_widget($panel['id'], $panel['title'], $panel['category']) );
add_action('widgets_init', $panel['id']);
$new_widget = new snow_panel_widget($panel['id'], $panel['title'], $panel['category']);
$register_panel = function() use ($new_widget) {
register_widget( $new_widget );
};
add_action('widgets_init', $register_panel);
}

/* Enable shortcodes */
Expand Down

0 comments on commit cd5cb42

Please sign in to comment.