当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Widget类代码示例

本文整理汇总了PHP中WP_Widget的典型用法代码示例。如果您正苦于以下问题:PHP WP_Widget类的具体用法?PHP WP_Widget怎么用?PHP WP_Widget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WP_Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: widget_form

    /**
     * @param array $settings
     * @param WP_Widget $widget
     */
    public function widget_form($settings, WP_Widget $widget)
    {
        $forms = mc4wp_get_forms();
        ?>
		<p>
			<label for="<?php 
        echo $widget->get_field_id('form_id');
        ?>
"><?php 
        _e('Form:', 'mailchimp-for-wp');
        ?>
</label>
			<select class="widefat" name="<?php 
        echo $widget->get_field_name('form_id');
        ?>
" id="<?php 
        echo $widget->get_field_id('form_id');
        ?>
">
				<option value="0" disabled <?php 
        selected($settings['form_id'], 0);
        ?>
><?php 
        _e('Select the form to show', 'mailchimp-for-wp');
        ?>
</option>
				<?php 
        foreach ($forms as $f) {
            ?>
					<option value="<?php 
            echo esc_attr($f->ID);
            ?>
" <?php 
            selected($settings['form_id'], $f->ID);
            ?>
><?php 
            echo esc_html($f->name);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>

		<?php 
        if (empty($forms)) {
            ?>
			<p class="help"><?php 
            printf(__('You don\'t have any sign-up forms. <a href="%s">Would you like to create one now?</a>', 'mailchimp-for-wp'), mc4wp_get_add_form_url());
            ?>
</p>
		<?php 
        }
    }
开发者ID:siggisdairy,项目名称:siggis-web,代码行数:59,代码来源:class-widget-enhancements.php

示例2: get_widget_instance

 /**
  * @return \WP_Widget
  */
 public function get_widget_instance()
 {
     if (is_null($this->_widget_instance)) {
         global $wp_widget_factory;
         if (isset($wp_widget_factory->widgets[$this->_widget_name])) {
             $this->_widget_instance = $wp_widget_factory->widgets[$this->_widget_name];
             $this->_widget_instance->_set('REPLACE_TO_ID');
         } elseif (class_exists($this->_widget_name)) {
             $this->_widget_instance = new $this->_widget_name();
             $this->_widget_instance->_set('REPLACE_TO_ID');
         }
     }
     return $this->_widget_instance;
 }
开发者ID:pojome,项目名称:elementor,代码行数:17,代码来源:wordpress.php

示例3: array

 function __construct()
 {
     // Widget settings
     $widget_options = array('classname' => 'pi_tweet_scroll', 'description' => __('A widget that displays your latest tweets.', 'pi_framework'));
     // Create the widget
     parent::__construct('pi_tweet_scroll', __('TweetScroll', 'pi_framework'), $widget_options);
 }
开发者ID:vanbungkring,项目名称:24custom,代码行数:7,代码来源:widget-tweetscroll.php

示例4: array

 function __construct()
 {
     $widget_ops = array('classname' => 'login', 'description' => __('This login widget lets you add a login form in the sidebar.', 'profilebuilder'));
     $control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'wppb-login-widget');
     do_action('wppb_login_widget_settings', $widget_ops, $control_ops);
     parent::__construct('wppb-login-widget', __('Profile Builder Login Widget', 'profilebuilder'), $widget_ops, $control_ops);
 }
开发者ID:nevredimiy,项目名称:1serebroopt,代码行数:7,代码来源:login-widget.php

示例5: array

 function __construct()
 {
     /* Widget settings. */
     $widget_ops = array('description' => _x('Custom menu style 2', 'widget', 'the7mk2'));
     /* Create the widget. */
     parent::__construct('presscore-custom-menu-2', DT_WIDGET_PREFIX . _x('Custom menu style 2', 'widget', 'the7mk2'), $widget_ops);
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:7,代码来源:custom-menu-2.php

示例6: array

 function __construct()
 {
     global $theme;
     $widget_options = array('description' => __('Add buttons to your social network profiles.', 'themater'));
     $control_options = array('width' => 480);
     parent::__construct('themater_social_profiles', '&raquo; Social Profiles', $widget_options, $control_options);
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:7,代码来源:social-profiles.php

示例7: __construct

 /**
  * Register widget with WordPress.
  */
 public function __construct()
 {
     parent::__construct('monster_facebook_page_widget', __('Monster Facebook page widget', 'photolab'), array('description' => __('Facebook page Widget', 'photolab')));
     // Set default settings
     $this->instance_default = array('title' => '', 'app_id' => '', 'page_title' => '', 'facebook_url' => '', 'tabs' => '', 'width' => '', 'height' => '', 'small_header' => 'false', 'adaptive_width' => 'false', 'hide_cover' => 'false', 'freinds_face' => 'true');
     $this->tabs = array('none' => 'none', 'timeline' => 'timeline', 'messages' => 'messages', 'events' => 'events');
 }
开发者ID:gcofficial,项目名称:basetheme,代码行数:10,代码来源:monster-facebook-page-widget.php

示例8: __construct

 public function __construct()
 {
     // load plugin text domain
     add_action('init', array($this, 'widget_textdomain'));
     // Hooks fired when the Widget is activated and deactivated
     register_activation_hook(__FILE__, array($this, 'activate'));
     register_deactivation_hook(__FILE__, array($this, 'deactivate'));
     parent::__construct('taxonomies-filter-widget', __('Taxonomies Filter', 'taxonomies-filter-widget'), array('classname' => 'taxonomies-filter-widget', 'description' => __('Filter posts by category and/or taxonomy.', 'taxonomies-filter-widget')));
     // Load plugin options and/or set the default values
     $this->tfw_options = wp_parse_args((array) get_option('tfw_options'), array('auto_submit' => 0, 'hide_empty' => 0, 'display_search_box' => 0, 'display_reset_button' => 0, 'multiple_relation' => ',', 'results_template' => 'search', 'custom_template' => 'search.php', 'post_count' => 'dynamic', 'search_box' => 'Keywords', 'search_button' => 'Search', 'reset_button' => 'Reset all'));
     add_option('tfw_options', $this->tfw_options);
     $this->filters = get_option('widget_taxonomies-filter-widget');
     // Register admin styles and scripts
     add_action('admin_enqueue_scripts', array($this, 'register_admin_scripts_styles'));
     // Register site styles and scripts
     add_action('wp_enqueue_scripts', array($this, 'register_widget_scripts'));
     add_action('wp_enqueue_scripts', array($this, 'register_widget_styles'));
     // Register the function that will handle the ajax request
     add_action('wp_ajax_get_term_childrens', array($this, 'ajax_drilldown'));
     add_action('wp_ajax_nopriv_get_term_childrens', array($this, 'ajax_drilldown'));
     // if is admin, create the options page, otherwise, set the search results template
     if (is_admin()) {
         add_action('admin_menu', array($this, 'tfw_options_page'));
         add_action('admin_init', array($this, 'tfw_page_init'));
         add_filter('plugin_action_links', array($this, 'add_settings_link'), 10, 2);
     } elseif (is_main_query()) {
         add_filter('get_meta_sql', array($this, 'cast_decimal_precision'));
         add_action('pre_get_posts', array($this, 'filter_by_custom_field'), 2);
         add_action('template_redirect', array($this, 'results_template'), 2);
     }
 }
开发者ID:barkdesignchicago,项目名称:BHPN,代码行数:31,代码来源:plugin.php

示例9: __construct

 public function __construct()
 {
     $this->args = $this->get_defaults();
     $this->admin_args = array('id' => 'hocwp_widget_facebook_messenger', 'name' => 'HocWP Facebook Messenger', 'class' => 'hocwp-facebook-messenger hocwp-widget-facebook-messenger', 'description' => __('Embed Facebook Messenger.', 'hocwp-theme'), 'width' => 400);
     $this->admin_args = apply_filters('hocwp_widget_facebook_messenger_admin_args', $this->admin_args, $this);
     parent::__construct($this->admin_args['id'], $this->admin_args['name'], array('classname' => $this->admin_args['class'], 'description' => $this->admin_args['description']), array('width' => $this->admin_args['width']));
 }
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:7,代码来源:class-hocwp-widget-facebook-messenger.php

示例10: __construct

 public function __construct()
 {
     load_plugin_textdomain('mapboxadv', false, basename(dirname(__FILE__)) . '/languages');
     //widget builder
     $this->wbuilder = new Mapbox_Builder();
     parent::__construct('Mapboxadv', 'Mapbox for WP Advanced', array('description' => 'Mapbox for WP Advanced'));
 }
开发者ID:erikb85,项目名称:mapbox-for-wp-advanced,代码行数:7,代码来源:mapboxwidgetadv.php

示例11: array

 /**
  * Constructor. Set the default widget options and create widget.
  *
  * @since 0.1.8
  */
 function __construct()
 {
     $this->defaults = array('title' => '', 'page_id' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_content' => 0, 'custom_text' => '', 'content_limit' => '', 'more_text' => '');
     $widget_ops = array('classname' => 'featured-content wsmfeaturedpage', 'description' => __('Displays featured page with thumbnails', 'genesis'));
     $control_ops = array('id_base' => 'wsmfeatured-page', 'width' => 200, 'height' => 250);
     parent::__construct('wsmfeatured-page', __('WSM - Featured Page', 'genesis'), $widget_ops, $control_ops);
 }
开发者ID:Bobcatou,项目名称:enhanceworldwide,代码行数:12,代码来源:wsm-featured-page.php

示例12: array

 /** constructor */
 function __construct()
 {
     $this->defaults = array('title' => __('Event Locations', 'dbem'), 'scope' => 'future', 'order' => 'ASC', 'limit' => 5, 'format' => '<li>#_LOCATIONLINK<ul><li>#_LOCATIONADDRESS</li><li>#_LOCATIONTOWN</li></ul></li>', 'no_locations_text' => '<li>' . __('No locations', 'dbem') . '</li>', 'orderby' => 'event_start_date,event_start_time,location_name');
     $this->em_orderby_options = array('event_start_date, event_start_time, location_name' => __('Event start date/time, location name', 'dbem'), 'location_name' => __('Location name', 'dbem'));
     $widget_ops = array('description' => __("Display a list of event locations on Events Manager.", 'dbem'));
     parent::__construct(false, $name = 'Event Locations', $widget_ops);
 }
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:8,代码来源:em-locations.php

示例13: array

 function __construct()
 {
     parent::__construct($this->id_base, $this->name, $this->widget_options);
     add_action('save_post', array($this, 'flush_widget_cache'));
     add_action('deleted_post', array($this, 'flush_widget_cache'));
     add_action('switch_theme', array($this, 'flush_widget_cache'));
 }
开发者ID:DimaStelmakh,项目名称:WEB4PRO-test,代码行数:7,代码来源:widget.php

示例14: array

 function __construct()
 {
     /* Widget settings. */
     $widget_ops = array('classname' => 'zp_contact_widget', 'description' => __('A widget that addresss your contact information.', 'novo'));
     /* Create the widget. */
     parent::__construct('zp_contact_widget', __('ZP Contact Widget', 'novo'), $widget_ops);
 }
开发者ID:lukasalbrecht,项目名称:www.genesis-playground.dev,代码行数:7,代码来源:widget-address.php

示例15: array

 /** constructor -- name this the same as the class above */
 function __construct()
 {
     $widget_ops = array('classname' => 'wplms_dash_news', 'description' => __('News for Members', 'wplms-dashboard'));
     $control_ops = array('width' => 300, 'height' => 350, 'id_base' => 'wplms_dash_news');
     parent::__construct('wplms_dash_news', __(' DASHBOARD : Member News', 'wplms-dashboard'), $widget_ops, $control_ops);
     add_action('init', array($this, 'register_essentials'));
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:8,代码来源:news.php


注:本文中的WP_Widget类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。