Dadde
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Replace and add this functions in widget_logic.php:
// the redirection comes here function widget_logic_redirected_callback() { global $wp_registered_widgets, $wp_reset_query_is_done; $params=func_get_args(); // get all the passed params $id=array_pop($params); // take off the widget ID $callback=$wp_registered_widgets[$id]['callback_wl_redirect']; // find the real callback $wl_options = get_option('widget_logic'); // do we want the widget? $wl_value=($wl_options[$id])?stripslashes($wl_options[$id]):"true"; $wl_value=(stristr($wl_value, "return"))?$wl_value:"return (".$wl_value.");"; global $widget_logic_id; // before we execute the condtional code, perhaps we want to wp_reset_query... if ($wl_options['widget_logic-options-wp_reset_query']=='checked' && !$wp_reset_query_is_done) { wp_reset_query(); $wp_reset_query_is_done=true; } $wl_value=(eval($wl_value) && is_callable($callback)); if ( $wl_value ) { if ($wl_options['widget_logic-options-filter']!='checked') call_user_func_array($callback, $params); // if so callback with original params! else { ob_start(); call_user_func_array($callback, $params); // if so callback with original params! $widget_content = ob_get_contents(); ob_end_clean(); if(($content = apply_filters( 'widget_content', $widget_content, $id))=="") { $widget_logic_id[] = $id; } else echo $content; } } else { $widget_logic_id[] = $id; } } add_filter('sidebars_widgets', 'widget_logic_remove_widgets'); function widget_logic_remove_widgets($sidebars='') { global $widget_logic_id; if(count($widget_logic_id)!=0) { foreach($sidebars as $sidebar_name => $widgets) { $i=0; foreach($widgets as $widgets_name) { if(in_array($widgets_name, $widget_logic_id)) { unset($sidebars[$sidebar_name][$i]); } $i++; } } } return $sidebars; }
Viewing 1 replies (of 1 total)