function ocpwp_widget_generator_init() { wp_register_sidebar_widget('ocpwp_widget_1', 'Opencart Category Display', 'ocpwp_widget_category_display', array('description' => 'Displays list of category from Opencart store')); wp_register_widget_control('ocpwp_widget_1', 'Opencart Category Display', 'ocpwp_widget_category_control'); wp_register_sidebar_widget('ocpwp_widget_2', 'Opencart Product Display', 'ocpwp_widget_product_display', array('description' => 'Displays list of product from Opencart store')); wp_register_widget_control('ocpwp_widget_2', 'Opencart Product Display', 'ocpwp_widget_product_control'); }
/** * Function to register the Widget functions */ function register_widget() { $name = __('NextGEN Media RSS', 'nggallery'); $control_ops = array('width' => 250, 'height' => 350, 'id_base' => 'ngg-mrssw'); $widget_ops = array('classname' => 'ngg_mrssw', 'description' => __('Widget that displays Media RSS links for NextGEN Gallery.', 'nggallery')); if (!is_array($this->options)) { $this->options = array(); } $registered = false; foreach (array_keys($this->options) as $o) { // Old widgets can have null values for some reason //-- if (!isset($this->options[$o]['show_global_mrss'])) { continue; } // $id should look like {$id_base}-{$o} //-- $id = "ngg-mrssw-{$o}"; $registered = true; wp_register_sidebar_widget($id, $name, array(&$this, 'render_widget'), $widget_ops, array('number' => $o)); wp_register_widget_control($id, $name, array(&$this, 'render_control_panel'), $control_ops, array('number' => $o)); } // If there are none, we register the widget's existance with a generic template //-- if (!$registered) { wp_register_sidebar_widget('ngg-mrssw-1', $name, array(&$this, 'render_widget'), $widget_ops, array('number' => -1)); wp_register_widget_control('ngg-mrssw-1', $name, array(&$this, 'render_control_panel'), $control_ops, array('number' => -1)); } }
function init() { if (!($options = get_option('widget_stray_quotes'))) { $options = array(); } $widget_ops = array('classname' => 'widget_stray_quotes', 'description' => ''); $control_ops = array('width' => 650, 'height' => 100, 'id_base' => 'stray_widgets'); $name = 'Quotes'; $registered = false; foreach (array_keys($options) as $o) { if (!isset($options[$o]['title'])) { continue; } $id = "stray_widgets-{$o}"; //check if the widgets is active global $wpdb; $sql = "SELECT option_value FROM {$wpdb->options} WHERE option_name = 'sidebars_widgets' AND option_value like '%" . $id . "%'"; $var = $wpdb->get_var($sql); //do this to keep the size of the array down if (!$var) { unset($options[$o]); } $registered = true; wp_register_sidebar_widget($id, $name, array(&$this, 'widget'), $widget_ops, array('number' => $o)); wp_register_widget_control($id, $name, array(&$this, 'control'), $control_ops, array('number' => $o)); } if (!$registered) { wp_register_sidebar_widget('stray_widgets-1', $name, array(&$this, 'widget'), $widget_ops, array('number' => -1)); wp_register_widget_control('stray_widgets-1', $name, array(&$this, 'control'), $control_ops, array('number' => -1)); } update_option('widget_stray_quotes', $options); }
function gfci_wall_multi_register() { if (!($options = get_option('wall_widget_gfci'))) { $options = array(); } $widget_ops = array('classname' => 'wall_widget_gfci', 'description' => __('Add a Google Friend Connect Wall Gadget')); $control_ops = array('width' => 420, 'height' => 420, 'id_base' => 'gfciwall'); $name = __('GFC Comments'); $registered = false; foreach (array_keys($options) as $o) { // Old widgets can have null values for some reason if (!isset($options[$o]['gadget_wid'])) { continue; } $id = "gfciwall-{$o}"; // Never never never translate an id $registered = true; wp_register_sidebar_widget($id, $name, 'GFCIWidget_Wall', $widget_ops, array('number' => $o)); wp_register_widget_control($id, $name, 'widget_gfci_wall_control', $control_ops, array('number' => $o)); } // If there are none, we register the widget's existance with a generic template if (!$registered) { wp_register_sidebar_widget('gfciwall-1', $name, 'GFCIWidget_Wall', $widget_ops, array('number' => -1)); wp_register_widget_control('gfciwall-1', $name, 'widget_gfci_wall_control', $control_ops, array('number' => -1)); } }
function ss_menu_widget_init() { if (!($options = get_option('ssMenu_widget_options'))) { $options = array(); } $control_ops = array('width' => 380, 'height' => 400, 'id_base' => 'ss_menu'); $widget_ops = array('classname' => 'ss_menu', 'description' => __('Animated expanding / fold down category menu to show subcategories and posts')); $name = __('SuperSlider Menu'); $id = false; foreach (array_keys($options) as $o) { // Old widgets can have null values for some reason if (!isset($options[$o]['title']) || !isset($options[$o]['title'])) { continue; } $id = "ss_menu-{$o}"; // Never never never translate an id wp_register_sidebar_widget($id, $name, 'ss_menu_widget', $widget_ops, array('number' => $o)); wp_register_widget_control($id, $name, 'ss_menu_widgetControl', $control_ops, array('number' => $o)); } // If there are none, we register the widget's existance with a generic template if (!$id) { wp_register_sidebar_widget('ss_menu-1', $name, 'ss_menu_widget', $widget_ops, array('number' => -1)); wp_register_widget_control('ss_menu-1', $name, 'ss_menu_widgetControl', $control_ops, array('number' => -1)); } }
function __construct($name, $params = array()) { parent::__construct($params); $this->name = $name; $this->id = strtolower(get_class($this)); $options = get_option($this->id); // register_sidebar_widget($this->name,array(&$this,'renderWidget')); $doesOwnConfig = $this->param('doesOwnConfig', false); $desc = $this->param('description', $this->name); $widget_ops = array('classname' => $this->id, 'description' => __($desc)); $control_ops = array('width' => 400, 'height' => 350, 'id_base' => $this->id); $name = $this->name; $id = false; do { if ($options) { foreach (array_keys($options) as $o) { // Old widgets can have null values for some reason if (!isset($options[$o]['exists'])) { continue; } $id = "{$this->id}-" . abs($o); // Never never never translate an id wp_register_sidebar_widget($id, $name, array(&$this, 'renderWidget'), $widget_ops, array('number' => $o)); wp_register_widget_control($id, $name, array(&$this, 'configForm'), $control_ops, array('number' => $o)); } } $options = array(-1 => array('exists' => 1)); } while (!$id); }
public static function init() { wp_register_sidebar_widget(LastTrackPlugin::PREFIX, __('Shoutcast last tracks', LastTrackPlugin::domain()), array(__CLASS__, 'draw')); wp_register_widget_control(LastTrackPlugin::PREFIX, __('Shoutcast last tracks', LastTrackPlugin::domain()), array(__CLASS__, 'settings')); add_action('wp_ajax_nopriv_' . LastTrackPlugin::PREFIX, array(__CLASS__, 'ajax')); add_action('wp_ajax_' . LastTrackPlugin::PREFIX, array(__CLASS__, 'ajax')); }
function init() { global $wp_version; global $advman_engine; $ads = $advman_engine->getAds(); if (!empty($ads)) { $widgets = array(); foreach ($ads as $id => $ad) { if (!empty($ad->name)) { $i = substr(md5($ad->name), 0, 10); $widgets[$i] = $ad; } } foreach ($widgets as $id => $ad) { $n = __('Ad: ', 'advman') . $ad->name; $description = __('An ad from the Advertising Manager plugin'); $args = array('name' => $n, 'description' => $description); if (function_exists('wp_register_sidebar_widget')) { //$id, $name, $output_callback, $options = array() wp_register_sidebar_widget("advman-{$id}", $n, array('Advman_Widget', 'widget'), $args, $ad->name); wp_register_widget_control("advman-{$id}", $n, array('Advman_Widget', 'widget_control'), null, null, $ad->name); } elseif (function_exists('register_sidebar_module')) { register_sidebar_module($n, array('Advman_Widget', 'sbm_widget'), "advman-{$id}", $args); register_sidebar_module_control($n, array('Advman_Widget', 'widget_control'), "advman-{$id}"); } } } }
function language_selector_widget_init() { wp_register_sidebar_widget('icl_lang_sel_widget', __('Language Selector', 'sitepress'), 'language_selector_widget', array('classname' => 'icl_languages_selector')); wp_register_widget_control('icl_lang_sel_widget_control', __('Language Selector', 'sitepress'), array(&$this, 'set_widget')); add_action('template_redirect', 'icl_lang_sel_nav_ob_start', 0); add_action('wp_head', 'icl_lang_sel_nav_ob_end'); }
/** * Registers the TubePress widget with WordPress. * * @return void */ public static function initAction() { $ioc = org_tubepress_impl_ioc_IocContainer::getInstance(); $msg = $ioc->get('org_tubepress_api_message_MessageService'); $widgetOps = array('classname' => 'widget_tubepress', 'description' => $msg->_('widget-description')); wp_register_sidebar_widget('tubepress', 'TubePress', array('org_tubepress_impl_env_wordpress_Widget', 'printWidget'), $widgetOps); wp_register_widget_control('tubepress', 'TubePress', array('org_tubepress_impl_env_wordpress_Widget', 'printControlPanel')); }
/** * Registers the TubePress widget with WordPress. * * @return void */ public static function initAction() { $ioc = org_tubepress_impl_ioc_IocContainer::getInstance(); $msg = $ioc->get(org_tubepress_api_message_MessageService::_); $widgetOps = array('classname' => 'widget_tubepress', 'description' => $msg->_('Displays YouTube or Vimeo videos with TubePress')); //>(translatable)< wp_register_sidebar_widget('tubepress', 'TubePress', array('org_tubepress_impl_env_wordpress_Widget', 'printWidget'), $widgetOps); wp_register_widget_control('tubepress', 'TubePress', array('org_tubepress_impl_env_wordpress_Widget', 'printControlPanel')); }
function load_widgets() { for ($pos = 1; $pos <= $this->widget_max; $pos++) { wp_register_sidebar_widget($this->id($pos), $this->name($pos), $pos <= $this->widget_available ? array(&$this, 'show_display') : '', $this->args(), $pos); if ($this->has_config()) { wp_register_widget_control($this->id($pos), $this->name($pos), $pos <= $this->widget_available ? array(&$this, 'show_config') : '', $this->args(), $pos); } } }
function widgetInit() { global $quoteRotator, $management; if (!function_exists('wp_register_sidebar_widget')) { return; } wp_register_sidebar_widget('flexi-quote-rotator', 'Flexi Quote Rotator', array(&$quoteRotator, 'displayWidget')); wp_register_widget_control('flexi-quote-rotator', 'Flexi Quote Rotator', array(&$management, 'displayWidgetControl')); }
function bp_blogs_register_widgets() { global $current_blog; /* Latest Posts Widget */ wp_register_sidebar_widget('buddypress-blogs', __('Recent Blog Posts', 'buddypress'), 'bp_blogs_widget_recent_posts'); wp_register_widget_control('buddypress-blogs', __('Recent Blog Posts', 'buddypress'), 'bp_blogs_widget_recent_posts_control'); if (is_active_widget('bp_blogs_widget_recent_posts')) { wp_enqueue_style('bp-blogs-widget-posts-css', BP_PLUGIN_URL . '/bp-blogs/css/widget-blogs.css'); } }
function bp_activity_register_widgets() { global $current_blog; /* Site Wide Activity Widget */ wp_register_sidebar_widget('buddypress-activity', __('Site Wide Activity', 'buddypress'), 'bp_activity_widget_sitewide_activity'); wp_register_widget_control('buddypress-activity', __('Site Wide Activity', 'buddypress'), 'bp_activity_widget_sitewide_activity_control'); if (is_active_widget('bp_activity_widget_sitewide_activity')) { wp_enqueue_style('bp-activity-widget-activity-css', BP_PLUGIN_URL . '/bp-activity/css/widget-activity.css'); } }
function jal_on_plugins_loaded() { if (function_exists('register_sidebar_widget')) { $widget_ops = array('classname' => 'widget_wordspew', 'description' => __('Add a shoutbox on your site', wordspew)); wp_register_sidebar_widget("shoutbox", __('Shoutbox', wordspew), 'widget_wordspew', $widget_ops); } if (function_exists('wp_register_widget_control')) { wp_register_widget_control("shoutbox", __('Shoutbox', wordspew), 'widget_wordspew_control', $widget_ops); } }
/** * Initialize the vCita widget by registering the widget hooks */ function vcita_init() { if (!function_exists('register_sidebar_widget') || !function_exists('register_widget_control')) { return; } vcita_initialize_data(); wp_register_sidebar_widget('vcita_widget_id', 'vCita Sidebar Widget', 'vcita_widget_content'); wp_register_widget_control('vcita_widget_id', 'vCita Sidebar Widget', 'vcita_widget_admin'); add_filter('plugin_action_links', 'vcita_add_settings_link', 10, 2); register_uninstall_hook(VCITA_WIDGET_UNIQUE_LOCATION, 'vcita_uninstall'); }
function groups_register_widgets() { global $current_blog; /* Site welcome widget */ wp_register_sidebar_widget('buddypress-groups', __('Groups', 'buddypress'), 'groups_widget_groups_list'); wp_register_widget_control('buddypress-groups', __('Groups', 'buddypress'), 'groups_widget_groups_list_control'); /* Include the javascript needed for activated widgets only */ if (is_active_widget('groups_widget_groups_list')) { wp_enqueue_script('groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery', 'jquery-livequery-pack')); wp_enqueue_style('groups_widget_members-css', BP_PLUGIN_URL . '/bp-groups/css/widget-groups.css'); } }
/** * bp_component_register_widgets() * * This function will register your widgets so that they will show up on the widget list * for site administrators to drop into their widget zones. */ function bp_chat_register_widgets() { global $current_blog; /* Site welcome widget */ wp_register_sidebar_widget('buddypress-chat', __('Cool Chat Widget', 'bp-chat'), 'bp_chat_widget_cool_widget'); wp_register_widget_control('buddypress-chat', __('Cool Chat Widget', 'bp-chat'), 'bp_chat_widget_cool_widget_control'); /* Include the javascript and /or CSS needed for activated widgets only. If none needed, this code can be left out. */ if (is_active_widget('bp_chat_widget_cool_widget')) { wp_enqueue_script('bp_chat_widget_cool_widget-js', WP_PLUGIN_URL . '/bp-chat/js/widget-chat.js', array('jquery', 'jquery-livequery-pack')); wp_enqueue_style('bp_chat_widget_cool_widget-css', WP_PLUGIN_URL . '/bp-chat/css/widget-chat.css'); } }
function widget_expand_control() { global $wp_registered_widgets, $wp_registered_widget_controls; foreach ($wp_registered_widgets as $id => $widget) { if (!isset($wp_registered_widget_controls[$id])) { wp_register_widget_control($id, $widget['name'], array(&$this, 'widget_empty_control')); } $wp_registered_widget_controls[$id]['callback_wpc_redirect'] = $wp_registered_widget_controls[$id]['callback']; $wp_registered_widget_controls[$id]['callback'] = array(&$this, 'widget_extra_control'); array_push($wp_registered_widget_controls[$id]['params'], $id); } }
public static function init() { // Check for the required plugin functions. This will prevent fatal // errors occurring when you deactivate the dynamic-sidebar plugin. if (!function_exists('register_sidebar_widget')) { return; } $widget = new WpWallRecentCommentsWidget(); // This registers our widget so it appears with the other available // widgets and can be dragged and dropped into any active sidebars. wp_register_sidebar_widget('Wp-Wall Recent Comments', 'Wp-Wall Recent Comments', 'Wp-Wall Recent Comments', array($widget, 'display')); // This registers our optional widget control form. wp_register_widget_control('Wp-Wall Recent Comments', array($widget, 'control'), 280, 300); }
function pdf24Plugin_registerWidget() { global $pdf24Plugin; $widgetId = 'Articles To PDF'; if (function_exists('wp_register_sidebar_widget')) { wp_register_sidebar_widget($widgetId, $widgetId, 'pdf24Plugin_widget'); include_once $pdf24Plugin['dir'] . '/inc/widgetControl.php'; wp_register_widget_control($widgetId, $widgetId, 'pdf24Plugin_widgetControl'); } else { register_sidebar_widget($widgetId, 'pdf24Plugin_widget'); include_once $pdf24Plugin['dir'] . '/inc/widgetControl.php'; register_widget_control($widgetId, 'pdf24Plugin_widgetControl'); } }
function init() { // check for the required WP functions, die silently for pre-2.8 WP. if (!function_exists('esc_js')) { return; } // load all l10n string upon entry load_plugin_textdomain('wet_proteinshake', false, dirname(plugin_basename(__FILE__))); // let WP know of this plugin's widget view entry wp_register_sidebar_widget('wet_proteinshake', __('Protein Shake Recipe', 'wet_proteinshake'), array('wet_proteinshake', 'widget'), array('classname' => 'wet_proteinshake', 'description' => __('Allows the user to calculate her optimum post-workout protein shake recipe.', 'wet_proteinshake'))); // let WP know of this widget's controller entry wp_register_widget_control('wet_proteinshake', __('Protein Shake Recipe', 'wet_proteinshake'), array('wet_proteinshake', 'control'), array('width' => 400)); // short code allows insertion of wet_proteinshake into regular posts as a [wet_proteinshake] tag. // From PHP in themes, call do_shortcode('wet_proteinshake'); add_shortcode('wet_proteinshake', array('wet_proteinshake', 'shortcode')); }
function init() { // check for the required WP functions, die silently for pre-2.8 WP. if (!function_exists('esc_js')) { return; } // load all l10n string upon entry load_plugin_textdomain('wet_bmicalc', false, dirname(plugin_basename(__FILE__))); // let WP know of this plugin's widget view entry wp_register_sidebar_widget('wet_bmicalc', __('Body Mass Index', 'wet_bmicalc'), array('wet_bmicalc', 'widget'), array('classname' => 'wet_bmicalc', 'description' => __('Allows the user to calculate the Body Mass Index (BMI) from body weight and height.', 'wet_bmicalc'))); // let WP know of this widget's controller entry wp_register_widget_control('wet_bmicalc', __('Body Mass Index', 'wet_bmicalc'), array('wet_bmicalc', 'control'), array('width' => 400)); // short code allows insertion of wet_bmicalc into regular posts as a [wet_bmicalc] tag. // From PHP in themes, call do_shortcode('wet_bmicalc'); add_shortcode('wet_bmicalc', array('wet_bmicalc', 'shortcode')); }
/** * Called on 'sidebar_admin_setup' * adds in the admin control per widget, but also processes import/export */ function expand_control() { global $wp_registered_widgets, $wp_registered_widget_controls; /* * Add fields to each widgets * pop the widget id on the params array (as it's not in the main params so not provided to the callback) */ foreach ($wp_registered_widgets as $id => $widget) { // controll-less widgets need an empty function so the callback function is called. if (!$wp_registered_widget_controls[$id]) { wp_register_widget_control($id, $widget['name'], array(&$this, 'empty_control')); } $wp_registered_widget_controls[$id]['callback_hw_redirect'] = $wp_registered_widget_controls[$id]['callback']; $wp_registered_widget_controls[$id]['callback'] = array(&$this, 'extra_control'); array_push($wp_registered_widget_controls[$id]['params'], $id); } }
function bp_core_register_widgets() { global $current_blog; /* Site welcome widget */ wp_register_sidebar_widget('buddypress-welcome', __('Welcome', 'buddypress'), 'bp_core_widget_welcome'); wp_register_widget_control('buddypress-welcome', __('Welcome', 'buddypress'), 'bp_core_widget_welcome_control'); /* Site members widget */ wp_register_sidebar_widget('buddypress-members', __('Members', 'buddypress'), 'bp_core_widget_members'); wp_register_widget_control('buddypress-members', __('Members', 'buddypress'), 'bp_core_widget_members_control'); /* Include the javascript needed for activated widgets only */ if (is_active_widget('bp_core_widget_members')) { wp_enqueue_script('bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.js', array('jquery', 'jquery-livequery-pack')); wp_enqueue_style('bp_core_widget_members-css', BP_PLUGIN_URL . '/bp-core/css/widget-members.css'); } wp_register_sidebar_widget('buddypress-whosonline', __("Who's Online", 'buddypress'), 'bp_core_widget_whos_online'); wp_register_widget_control('buddypress-whosonline', __("Who's Online", 'buddypress'), 'bp_core_widget_whos_online_control'); }
function widget_logic_expand_control() { global $wp_registered_widgets, $wp_registered_widget_controls; if (!($wl_options = get_option('widget_logic')) || !is_array($wl_options)) { $wl_options = array(); } // if we're just updating the widgets, just read in the widget logic settings - makes this WP2.5+ only i think if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) { foreach ((array) $_POST['widget-id'] as $widget_number => $widget_id) { if (isset($_POST[$widget_id . '-widget_logic'])) { $wl_options[$widget_id] = $_POST[$widget_id . '-widget_logic']; } } // clean up empty options (in PHP5 use array_intersect_key) $regd_plus_new = array_merge(array_keys($wp_registered_widgets), array_values((array) $_POST['widget-id']), array('widget_logic-options-filter', 'widget_logic-options-wp_reset_query')); foreach (array_keys($wl_options) as $key) { if (!in_array($key, $regd_plus_new)) { unset($wl_options[$key]); } } } foreach ($wp_registered_widgets as $id => $widget) { if (!$wp_registered_widget_controls[$id]) { wp_register_widget_control($id, $widget['name'], 'widget_logic_empty_control'); } if (!array_key_exists(0, $wp_registered_widget_controls[$id]['params']) || is_array($wp_registered_widget_controls[$id]['params'][0])) { $wp_registered_widget_controls[$id]['params'][0]['id_for_wl'] = $id; } else { // some older widgets put number in to params directly (which messes up the 'templates' in WP2.5) array_push($wp_registered_widget_controls[$id]['params'], $id); $wp_registered_widget_controls[$id]['height'] += 40; // this is really a pre2.5 thing - discard? } // do the redirection $wp_registered_widget_controls[$id]['callback_wl_redirect'] = $wp_registered_widget_controls[$id]['callback']; $wp_registered_widget_controls[$id]['callback'] = 'widget_logic_extra_control'; } // check the 'widget content' filter option if (isset($_POST['widget_logic-options-submit'])) { $wl_options['widget_logic-options-filter'] = $_POST['widget_logic-options-filter']; $wl_options['widget_logic-options-wp_reset_query'] = $_POST['widget_logic-options-wp_reset_query']; } update_option('widget_logic', $wl_options); }
function widget_wkc_advanced_blogroll_init() { if (!function_exists('wp_register_sidebar_widget')) { return; } ### Function: WKC Advanced Blogroll Widget function widget_wkc_advanced_blogroll($args) { extract($args); $options = get_option('widget_wkc_advanced_blogroll'); if (function_exists('wp_list_bookmarks')) { $param = array('title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, 'orderby' => $options['orderby'], 'category' => $options['category'], 'limit' => $options['limit'], 'show_images' => true, 'class' => 'linkcat widget', 'echo' => 0); echo wp_list_bookmarks($param); } } ### Function: WKC Advanced Blogroll Widget Options function widget_wkc_advanced_blogroll_options() { $options = get_option('widget_wkc_advanced_blogroll'); if (!is_array($options)) { $options = array('orderby' => 'name', 'limit' => '-1', 'category' => ''); } if (isset($_POST['wkc_ab-submit']) && $_POST['wkc_ab-submit'] == 1) { $options['orderby'] = $_POST['wkc_ab-orderby']; $options['limit'] = $_POST['wkc_ab-limit']; $options['category'] = $_POST['wkc_ab-category']; update_option('widget_wkc_advanced_blogroll', $options); } echo '<p style="text-align: left;font-size:12px"><label for="wkc_ab-limit">'; _e('Number of Links: ', 'wpkitcn'); echo '</label><input type="text" id="wkc_ab-limit" name="wkc_ab-limit" value="' . intval($options['limit']) . '" size="3" /><br/>' . __('-1 means disable number limitation.', 'wpkitcn') . '</p>' . "\n"; echo '<p style="text-align: left;font-size:12px"><label for="wkc_ab-orderby">'; _e('Order by: ', 'wpkitcn'); echo '</label><input type="text" id="wkc_ab-orderby" name="wkc_ab-orderby" value="' . $options['orderby'] . '" size="5" /><br/>' . __("Optional ways:<br />name,rand,id,url,lenght etc.", 'wpkitcn') . '</p>' . "\n"; echo '<p style="text-align: left;font-size:12px"><label for="wkc_ab-category">'; _e('Category to display: ', 'wpkitcn'); echo '</label><input type="text" id="wkc_ab-category" name="wkc_ab-category" value="' . $options['category'] . '" size="5" /><br/>' . __('Comma separated list of numeric Category IDs to be displayed. ', 'wpkitcn') . '</p>' . "\n"; echo '<input type="hidden" id="wkc_ab-submit" name="wkc_ab-submit" value="1" />' . "\n"; } $widget_ops = array('classname' => 'widget_wkc_advanced_blogroll', 'description' => __('List links in specified categories through specified way.', 'wpkitcn')); // Register Widgets wp_register_sidebar_widget('wkc_advanced_blogroll', __('WKC Advanced Blogroll', 'wpkitcn'), 'widget_wkc_advanced_blogroll', $widget_ops); wp_register_widget_control('wkc_advanced_blogroll', __('WKC Advanced Blogroll', 'wpkitcn'), 'widget_wkc_advanced_blogroll_options', array('width' => 400, 'height' => 200)); }
function WPWall_Init() { // alternative way $widget_options = array('classname' => 'WPWall_Widget', 'description' => "A comment 'Wall' for your sidebar."); wp_register_sidebar_widget('WP Wall', 'WP Wall', 'WPWall_Widget', $widget_options); // register widget control wp_register_widget_control('WP Wall', 'WPWall_WidgetControl', 'WPWall_WidgetControl'); $options = WPWall_GetOptions(); // get our wall pageId $pageId = $options['pageId']; // check if the actual post exists $actual_post = get_post($pageId); // check if the page is already created if (!$pageId || !$actual_post || $pageId != $actual_post->ID) { // create the page and save it's ID $options['pageId'] = WPWall_CreatePage(); update_option('wp_wall', $options); } }
/** * Registered Callback function for the admin sidebar setup * * Augments the Widgets with extra control to specify a CSS class */ function th_widget_css_expand_control() { global $wp_registered_widgets, $wp_registered_widget_controls, $th_widgetcss_options; if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) { foreach ((array) $_POST['widget-id'] as $widget_number => $widget_id) { if (isset($_POST[$widget_id . '-widget_css'])) { $th_widgetcss_options[$widget_id] = $_POST[$widget_id . '-widget_css']; } } } update_option('widget_css', $th_widgetcss_options); foreach ($wp_registered_widgets as $id => $widget) { if (!$wp_registered_widget_controls[$id]) { wp_register_widget_control($id, $widget['name'], 'widget_css_empty_control'); } $wp_registered_widget_controls[$id]['callback_widget_css_redirect'] = $wp_registered_widget_controls[$id]['callback']; $wp_registered_widget_controls[$id]['callback'] = 'widget_css_extra_control'; array_push($wp_registered_widget_controls[$id]['params'], $id); } }