function theme_widget_extra_control() { global $wp_registered_widget_controls, $theme_widgets_style, $theme_widget_meta_options; $_theme_widget_meta_options = $theme_widget_meta_options; $params = func_get_args(); $widget_id = $params[count($params) - 1]; $widget_controls = theme_get_array_value($wp_registered_widget_controls, $widget_id, array()); if (isset($widget_controls['callback_redirect'])) { $callback = $widget_controls['callback_redirect']; if (is_callable($callback)) { call_user_func_array($callback, $params); } } if (!preg_match('/^(.*[^-])-([0-9]+)$/', $widget_id, $matches) || !isset($matches[1]) || !isset($matches[2])) { return false; } $id = $matches[1] . '-' . $params[0]['number']; ?> <h3 style="margin-bottom:3px;"><?php _e('Theme Options', THEME_NS); ?> </h3> <?php theme_print_meta_box($id, $_theme_widget_meta_options); }
function theme_print_post_meta_box($post) { global $theme_post_meta_options; theme_print_meta_box($post->ID, $theme_post_meta_options); }
function theme_widget_extra_control() { global $wp_registered_widget_controls, $theme_widgets_style, $theme_widget_meta_options; $_theme_widget_meta_options = $theme_widget_meta_options; $params = func_get_args(); $widget_id = $params[count($params) - 1]; // see theme_widget_expand_control func $widget_controls = theme_get_array_value($wp_registered_widget_controls, $widget_id, array()); if (isset($widget_controls['callback_redirect'])) { $callback = $widget_controls['callback_redirect']; if (is_callable($callback)) { call_user_func_array($callback, $params); } } if (!preg_match('/^(.*[^-])-([0-9]+)$/', $widget_id, $matches) || !isset($matches[1]) || !isset($matches[2])) { return false; } $id = $matches[1] . '-' . $params[0]['number']; if (theme_is_vmenu_widget($id)) { $need_delete = false; foreach ($_theme_widget_meta_options as $option_id => $option) { if ($option['id'] == 'theme_widget_styles') { $need_delete = true; break; } } if ($need_delete) { unset($_theme_widget_meta_options[$option_id]); } } ?> <h3 style="margin-bottom:3px;"><?php _e('Theme Options', THEME_NS); ?> </h3> <?php theme_print_meta_box($id, $_theme_widget_meta_options); }