本文整理汇总了PHP中WP_Widget::WP_Widget方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Widget::WP_Widget方法的具体用法?PHP WP_Widget::WP_Widget怎么用?PHP WP_Widget::WP_Widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Widget
的用法示例。
在下文中一共展示了WP_Widget::WP_Widget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twitterwidget
function twitterwidget()
{
$widget_ops = array('classname' => 'twitterwidget', 'description' => 'Your twitter recent post list here.');
// $control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'TwitterWidget-widget');
// parent::WP_Widget(false, $name = 'WenderHost Subpages', $widget_ops);
parent::WP_Widget(false, 'recent Twitter posts', $widget_ops);
}
示例2: array
function cart_menu()
{
$widget_ops = array('classname' => 'cart_menu_class', 'description' => 'Show a bar with custom cart for woocommerce');
wp_register_style('style.css', CART_MENU__PLUGIN_URL . 'css/style.css');
wp_enqueue_style('style.css');
parent::WP_Widget(false, $name = __('Woocommerce Cart Widget', 'wp_cart_menu'));
}
示例3: array
/** constructor */
function rotatingtweets_Widget()
{
parent::WP_Widget(false, $name = 'Rotating Tweets', array('description' => __('A widget to show tweets for a particular user in rotation.', 'rotatingtweets')));
if (is_active_widget(false, false, $this->id_base)) {
rotatingtweets_enqueue_scripts();
}
}
示例4: htIntraverts
function htIntraverts()
{
parent::WP_Widget(false, __('HT Intraverts', 'govintranet'), array('description' => __('Displays an individual spot from a selection of spots and hides from user if already viewed', 'govintranet')));
/*
Load css
*/
wp_enqueue_style('intraverts', plugins_url("/ht-intraverts-ajax/css/ht_intraverts.css"));
/*
Register intravert custom post type
*/
add_action('init', 'cptui_register_my_cpt_intravert');
function cptui_register_my_cpt_intravert()
{
register_post_type('intravert', array('label' => 'Intraverts', 'description' => '', 'public' => false, 'show_ui' => true, 'show_in_menu' => true, 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => array('slug' => 'intravert', 'with_front' => true), 'query_var' => true, 'has_archive' => true, 'exclude_from_search' => true, 'menu_position' => '30', 'menu_icon' => 'dashicons-welcome-view-site', 'supports' => array('title', 'editor', 'excerpt', 'revisions', 'thumbnail', 'author', 'page-attributes'), 'labels' => array('name' => 'Intraverts', 'singular_name' => 'Intravert', 'menu_name' => 'Intraverts', 'add_new' => __('Add Intravert', 'govintranet'), 'add_new_item' => __('Add New Intravert', 'govintranet'), 'edit' => __('Edit', 'govintranet'), 'edit_item' => __('Edit Intravert', 'govintranet'), 'new_item' => __('New Intravert', 'govintranet'), 'view' => __('View Intravert', 'govintranet'), 'view_item' => __('View Intravert', 'govintranet'), 'search_items' => __('Search Intraverts', 'govintranet'), 'not_found' => __('No Intraverts Found', 'govintranet'), 'not_found_in_trash' => __('No Intraverts Found in Trash', 'govintranet'), 'parent' => __('Parent Intravert', 'govintranet'))));
}
/*
Register Advanced Custom Fields for the intraverts custom post type
*/
if (function_exists('register_field_group')) {
register_field_group(array('key' => 'group_5494c172a5fb9', 'title' => 'Intraverts', 'fields' => array(array('key' => 'field_5494c635e6e0e', 'label' => __('Link text', 'govintranet'), 'name' => 'intravert_link_text', 'prefix' => '', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_5494c648e6e0f', 'label' => __('Intranet destination page', 'govintranet'), 'name' => 'intravert_destination_page', 'prefix' => '', 'type' => 'relationship', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'post_type' => '', 'taxonomy' => '', 'filters' => array(0 => 'search', 1 => 'post_type', 2 => 'taxonomy'), 'elements' => array(0 => 'featured_image'), 'max' => 1, 'return_format' => 'id'), array('key' => 'field_54bc153f9a49c', 'label' => 'Cookie period', 'name' => 'intravert_cookie_period', 'prefix' => '', 'type' => 'number', 'instructions' => 'The number of days before the intravert will reappear after being viewed. Default is 14 days.', 'required' => 0, 'conditional_logic' => 0, 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'min' => '', 'max' => '', 'step' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_5494c1c796832', 'label' => __('Date range', 'govintranet'), 'name' => 'intravert_date_range', 'prefix' => '', 'type' => 'true_false', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'message' => '', 'default_value' => 0), array('key' => 'field_5494c21a96833', 'label' => __('Start date', 'govintranet'), 'name' => 'intravert_start_date', 'prefix' => '', 'type' => 'date_picker', 'instructions' => '', 'required' => 1, 'conditional_logic' => array(array('rule_rule_rule_0' => array('field' => 'field_5494c1c796832', 'operator' => '==', 'value' => '1'))), 'display_format' => 'd/m/Y', 'return_format' => 'd/m/Y', 'first_day' => 1), array('key' => 'field_5494c25596834', 'label' => __('End date', 'govintranet'), 'name' => 'intravert_end_date', 'prefix' => '', 'type' => 'date_picker', 'instructions' => '', 'required' => 1, 'conditional_logic' => array(array('rule_rule_rule_0' => array('field' => 'field_5494c1c796832', 'operator' => '==', 'value' => '1'))), 'display_format' => 'd/m/Y', 'return_format' => 'd/m/Y', 'first_day' => 1), array('key' => 'field_5494c18696831', 'label' => __('Target logged in users', 'govintranet'), 'name' => 'intravert_logged_in_only', 'prefix' => '', 'type' => 'true_false', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'message' => '', 'default_value' => 0), array('key' => 'field_5494d7fd784af', 'label' => __('Contributors and above', 'govintranet'), 'name' => 'intravert_contributors', 'prefix' => '', 'type' => 'true_false', 'instructions' => '', 'required' => 0, 'conditional_logic' => array(array('rule_0' => array('field' => 'field_5494c18696831', 'operator' => '==', 'value' => '1'))), 'message' => '', 'default_value' => 0), array('key' => 'field_5494c2af96836', 'label' => __('Teams', 'govintranet'), 'name' => 'intravert_teams', 'prefix' => '', 'type' => 'relationship', 'instructions' => '', 'required' => 0, 'conditional_logic' => array(array('rule_rule_rule_0' => array('field' => 'field_5494c18696831', 'operator' => '==', 'value' => '1'))), 'post_type' => array(0 => 'team'), 'taxonomy' => '', 'filters' => array(0 => 'search'), 'elements' => '', 'max' => '', 'return_format' => 'object'), array('key' => 'field_5494c30696837', 'label' => __('Grades', 'govintranet'), 'name' => 'intravert_grades', 'prefix' => '', 'type' => 'taxonomy', 'instructions' => '', 'required' => 0, 'conditional_logic' => array(array('rule_rule_rule_0' => array('field' => 'field_5494c18696831', 'operator' => '==', 'value' => '1'))), 'taxonomy' => 'grade', 'field_type' => 'checkbox', 'allow_null' => 0, 'load_save_terms' => 0, 'return_format' => 'object', 'multiple' => 0), array('key' => 'field_5494c29196835', 'label' => __('Target content', 'govintranet'), 'name' => 'intravert_target_content', 'prefix' => '', 'type' => 'select', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'choices' => array('All' => 'All', 'Task category' => 'Task category', 'News type' => 'News type'), 'default_value' => array(), 'allow_null' => 0, 'multiple' => 0, 'ui' => 0, 'ajax' => 0, 'placeholder' => '', 'disabled' => 0, 'readonly' => 0), array('key' => 'field_5494d3330049d', 'label' => __('Task category', 'govintranet'), 'name' => 'intravert_category', 'prefix' => '', 'type' => 'taxonomy', 'instructions' => '', 'required' => 0, 'conditional_logic' => array(array('rule_rule_rule_rule_0' => array('field' => 'field_5494c29196835', 'operator' => '==', 'value' => 'Task category'))), 'taxonomy' => 'category', 'field_type' => 'checkbox', 'allow_null' => 0, 'load_save_terms' => 0, 'return_format' => 'id', 'multiple' => 0), array('key' => 'field_5494d775784ae', 'label' => __('News type', 'govintranet'), 'name' => 'intravert_news_type', 'prefix' => '', 'type' => 'taxonomy', 'instructions' => '', 'required' => 0, 'conditional_logic' => array(array('rule_rule_0' => array('field' => 'field_5494c29196835', 'operator' => '==', 'value' => 'News type'))), 'taxonomy' => 'news-type', 'field_type' => 'checkbox', 'allow_null' => 0, 'load_save_terms' => 0, 'return_format' => 'id', 'multiple' => 0)), 'location' => array(array(array('param' => 'post_type', 'operator' => '==', 'value' => 'intravert'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => ''));
/*
Register Advanced Custom Fields for the intraverts widget
*/
register_field_group(array('key' => 'group_54c2f059881dc', 'title' => __('Intraverts widget', 'govintranet'), 'fields' => array(array('key' => 'field_54c2f09fa63e3', 'label' => __('Eligible intraverts', 'govintranet'), 'name' => 'eligible_intraverts', 'prefix' => '', 'type' => 'relationship', 'instructions' => __('Choose which intraverts are eligible to appear in this widget area.', 'govintranet'), 'required' => 0, 'conditional_logic' => 0, 'post_type' => array(0 => 'intravert'), 'taxonomy' => '', 'filters' => array(0 => 'search'), 'elements' => array(0 => 'featured_image'), 'max' => '', 'return_format' => 'id')), 'location' => array(array(array('param' => 'widget', 'operator' => '==', 'value' => 'htintraverts'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => ''));
}
}
示例5: array
/** constructor */
function footer_box_widget()
{
global $themename;
$widget_options = array('classname' => 'footer_box_widget', 'description' => 'Displays Box with some content');
$control_options = array('width' => 342);
parent::WP_Widget('medicenter_footer_box', __('Footer Box', 'medicenter'), $widget_options, $control_options);
}
示例6: array
function UW_Widget_Single_Image()
{
parent::WP_Widget($id = 'pic-text', $name = 'Single Image', $options = array('description' => 'Display an image with some featured text.', 'classname' => 'pic-text-widget'));
if (is_admin()) {
add_action('admin_enqueue_scripts', array(__CLASS__, 'scripts'));
}
}
示例7: ThemetonTabContainerWidget
function ThemetonTabContainerWidget()
{
$widget_ops = array('classname' => 'ThemetonTabContainerWidget', 'description' => 'Recent posts with Thumbnail.');
// $control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'TwitterWidget-widget');
// parent::WP_Widget(false, $name = 'WenderHost Subpages', $widget_ops);
parent::WP_Widget(false, 'Themeton tabbed widgets', $widget_ops);
}
示例8: sociallinkswidget
function sociallinkswidget()
{
$widget_ops = array('classname' => 'sociallinkswidget', 'description' => 'Please enter your social site accounts.', 'social_title' => 'Enter the Title for you Social links');
// $control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'TwitterWidget-widget');
// parent::WP_Widget(false, $name = 'WenderHost Subpages', $widget_ops);
parent::WP_Widget(false, 'Themeton social links', $widget_ops);
}
示例9: htMostActive
function htMostActive()
{
parent::WP_Widget(false, __('HT Most active', 'govintranet'), array('description' => __('Display pages with most pageviews', 'govintranet')));
if (function_exists('register_field_group')) {
register_field_group(array('key' => 'group_54c3150a2b558', 'title' => __('Most active widget', 'govintranet'), 'fields' => array(array('key' => 'field_55327bd9f4f3d', 'label' => __('Show guide chapters', 'govintranet'), 'name' => 'show_guide_chapters', 'prefix' => '', 'type' => 'true_false', 'instructions' => __('If enabled, this option will show individual guide chapters. If disabled, only main guide pages will appear.', 'govintranet'), 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'message' => '', 'default_value' => 0), array('key' => 'field_54c31510b4670', 'label' => __('Exclude', 'govintranet'), 'name' => 'exclude_posts', 'prefix' => '', 'type' => 'relationship', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'post_type' => '', 'taxonomy' => '', 'filters' => array(0 => 'search', 1 => 'post_type'), 'elements' => '', 'max' => '', 'return_format' => 'id')), 'location' => array(array(array('param' => 'widget', 'operator' => '==', 'value' => 'htmostactive'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => ''));
}
}
示例10: array
/** constructor */
function home_box_widget()
{
global $themename;
$widget_options = array('classname' => 'home_box_widget', 'description' => 'Displays Box with some content');
$control_options = array('width' => 460);
parent::WP_Widget('gymbase_home_box', __('Home Box', $themename), $widget_options, $control_options);
}
示例11: array
function Wdfb_WidgetConnect()
{
$widget_ops = array('classname' => __CLASS__, 'description' => __('Shows Facebook Connect box.', 'wdfb'));
add_action('wp_print_styles', array($this, 'css_load_styles'));
add_action('wp_print_scripts', array($this, 'js_load_scripts'));
parent::WP_Widget(__CLASS__, 'Facebook Connect', $widget_ops);
}
示例12: array
/** constructor */
function departments_widget()
{
global $themename;
$widget_options = array('classname' => 'departments_widget', 'description' => 'Displays Departments Accordion');
$control_options = array('width' => 460);
parent::WP_Widget('medicenter_departments', __('Departments Accordion', 'medicenter'), $widget_options, $control_options);
}
示例13: HW_Yahoo_Skype_status
/**
* constructor
*/
public function HW_Yahoo_Skype_status()
{
parent::WP_Widget(false, $name = __('Online yahoo skype status', 'hwyk'), array('description' => __('Display yahoo skype status widget.', 'hwyk')));
//you should check if whether this widget actived on frontend or neither maybe you can get widget data by get_option($this->option_name)
if (!is_admin() && !is_active_widget(false, false, $this->id_base, true)) {
return;
}
//instance skin
if (class_exists('HW_SKIN')) {
$this->skin = new HW_SKIN($this, HW_YK_PLUGIN_PATH, 'hw_yahooskype', 'yahooskype.php', 'skins');
$this->skin->plugin_url = HW_YK_PLUGIN_URL;
$this->skin->create('phone_icons', 'resources')->set_resource_path_skins('phone-icons');
//create phones icon skin manager
$this->skin->create('mail_icons', 'resources')->set_resource_path_skins('mail-icons');
//create mail icon skin manager
$this->skin->create('yahoo_icons', 'resources')->set_resource_path_skins('yahoo-icons');
//create yahoo icon skin manager
$this->skin->create('skype_icons', 'resources')->set_resource_path_skins('skype-icons');
//create skype icon skin manager
//$this->skin->create('avatars','resources')->set_resource_path_skins('avatars'); //avatars image
$this->skin->get_skin_instance('phone_icons')->enable_external_callback = false;
$this->skin->get_skin_instance('mail_icons')->enable_external_callback = false;
$this->skin->get_skin_instance('yahoo_icons')->enable_external_callback = false;
$this->skin->get_skin_instance('skype_icons')->enable_external_callback = false;
//$this->skin->get_skin_instance('avatars')->enable_external_callback = false;
$this->skin->enable_template_engine();
}
//ajax callback
#add_action("wp_ajax_hw_yahooskype_add_contact", array('HW_Yahoo_Skype_status',"add_new"));
#add_action("wp_ajax_nopriv_hw_yahooskype_add_contact", array('HW_Yahoo_Skype_status',"add_new"));
add_action('admin_enqueue_scripts', array(&$this, '_admin_enqueue_scripts'));
}
示例14: array
/**
* Constructor.
*/
function __construct()
{
// Set up optional widget args
$widget_ops = array('classname' => 'widget_bp_follow_following_widget widget buddypress', 'description' => __("Show a list of member avatars that the logged-in user is following.", 'bp-follow'));
// Set up the widget
parent::WP_Widget(false, __("(BP Follow) Users I'm Following", 'bp-follow'), $widget_ops);
}
示例15: HW_LC_Taxonomy
/**
* constructor
*/
public function HW_LC_Taxonomy()
{
parent::WP_Widget('hwlct_taxonomy', $name = 'HW Liệt kê categories/taxonomy terms');
//you should check if whether this widget actived on frontend or neither maybe you can get widget data by get_option($this->option_name)
if (!is_admin() && !is_active_widget(false, false, $this->id_base, true)) {
return;
}
if (!is_admin()) {
HW_HOANGWEB::load_class('hwArray');
}
//init skins
if (class_exists('HW_SKIN')) {
$this->skin = new HW_SKIN($this, plugin_dir_path(__FILE__), 'hw_lct_skins', 'hwlct-skin.php', 'skins');
#$this->skin->set_group('group1');
$this->skin->plugin_url = plugins_url('', __FILE__);
$this->skin->enable_external_callback = false;
#$this->skin->getSavedCallbacksJs_data(array($this,'get_callbacks_data'));
#$this->skin->create('t1')->files_skin_folder = 'images'; //set skin folder files
#$this->skin->create('t2')->files_skin_folder = 'image1'; //set skin folder files
#$this->skin->create('t3','group2','hwlct-pagi-skin.php'); //set skin folder files
#$this->skin->get_skin_instance('t1')->getSavedCallbacksJs_data(array($this,'get_callbacks_data'));
$this->skin->registerExternalStorage_JSCallback(array($this, 'save_callback_event'));
$this->skin->enable_template_engine(1, 0);
$this->skin->init();
}
if (class_exists('HW_AWC')) {
/*HW_AWC::register_widget_feature($this,'grid_posts'); //dynamic config
HW_AWC::register_widget_feature($this, 'fancybox');*/
}
$this->setup_actions();
}