PHP WP_Widget Code Examples

PHP WP_Widget - 30 examples found. These are the top rated real world PHP examples of WP_Widget extracted from open source projects. You can rate examples to help us improve the quality of examples
    /**
     * @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 
        }
    }
Example #2
0
 /**
  * @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;
 }
 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);
 }
Example #4
0
 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);
 }
 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);
 }
Example #6
0
 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);
 }
 /**
  * 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');
 }
Example #8
0
 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);
     }
 }
 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']));
 }
 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'));
 }
 /**
  * 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);
 }
Example #12
0
 /** 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);
 }
Example #13
0
 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'));
 }
 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);
 }
Example #15
0
 /** 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'));
 }
Example #16
0
 function __construct()
 {
     /* Widget settings. */
     $widget_ops = array('description' => _x('Blog posts', 'widget', LANGUAGE_ZONE));
     /* Create the widget. */
     parent::__construct('presscore-blog-posts', DT_WIDGET_PREFIX . _x('Blog posts', 'widget', LANGUAGE_ZONE), $widget_ops);
 }
 /**
  * Sets up a new Text widget instance.
  *
  * @since 2.8.0
  * @access public
  */
 public function __construct()
 {
     $widget_ops = array('classname' => 'baldwin_widget_case_study_box', 'description' => __('Case Study box for the Case Study listing, styled for the Baldwin site.'));
     $control_ops = array('width' => 400, 'height' => 350);
     parent::__construct('baldwin_case_study_box', __('Baldwin Case Study Box'), $widget_ops, $control_ops);
     add_action('admin_enqueue_scripts', array($this, 'upload_scripts'));
 }
 /**
  * Constructor
  *
  * @param string $name The widget name.
  * @param string $label The widget label.
  * @param string $description The widget description.
  * @param string $shortcode The widget shortcode.
  */
 public function __construct($name, $label, $description, $shortcode)
 {
     parent::__construct($name, $label, array('description' => $description));
     $thb_theme = thb_theme();
     $this->_shortcode = $thb_theme->getShortcode($shortcode);
     $this->_description = $description;
 }
 /**
  * Initializes the widget
  *
  * @since 1.2.0
  */
 function SlideshowPluginWidget()
 {
     // Settings
     $options = array('classname' => 'SlideshowWidget', 'description' => __('Enables you to show your slideshows in the widget area of your website.', 'slideshow-plugin'));
     // Create the widget.
     parent::__construct('slideshowWidget', __('Slideshow Widget', 'slideshow-plugin'), $options);
 }
 function __construct()
 {
     parent::__construct('grofile', apply_filters('jetpack_widget_name', __('Gravatar Profile', 'jetpack')), array('classname' => 'widget-grofile grofile', 'description' => __('Display a mini version of your Gravatar Profile', 'jetpack')));
     if (is_admin()) {
         add_action('admin_footer-widgets.php', array($this, 'admin_script'));
     }
 }
Example #21
0
 function mom_social_counter()
 {
     $widget_ops = array('classname' => 'momizat-social_counter', 'description' => __('Widget display a count of your social networks followers/fans numbers', 'framework'));
     /*		$control_ops = array( 'twitter name' => 'momizat', 'count' => 3, 'avatar_size' => '32' );
     */
     parent::__construct('momizatSocialCounter', __('Momizat - Social Counter', 'framework'), $widget_ops);
 }
Example #22
0
 /**
  * Register widget with WordPress.
  */
 public function __construct()
 {
     parent::__construct('twitter_timeline', apply_filters('jetpack_widget_name', esc_html__('Twitter Timeline', 'jetpack')), array('classname' => 'widget_twitter_timeline', 'description' => __('Display an official Twitter Embedded Timeline widget.', 'jetpack')));
     if (is_active_widget(false, false, $this->id_base) || is_active_widget(false, false, 'monster')) {
         wp_enqueue_script('twitter-widgets', '//platform.twitter.com/widgets.js', '', '', true);
     }
 }
 /**
  * Constructor. Set the default widget options and create widget.
  *
  * @since 0.1.8
  */
 function __construct()
 {
     $this->defaults = array('title' => '', 'posts_cat' => '', 'posts_num' => 1, 'posts_offset' => 0, 'orderby' => '', 'order' => '', 'exclude_displayed' => 0, 'exclude_sticky' => 0, 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_gravatar' => 0, 'gravatar_alignment' => '', 'gravatar_size' => '', 'show_title' => 0, 'show_byline' => 0, 'post_info' => '[post_date] ' . __('By', 'genesis') . ' [post_author_posts_link] [post_comments]', 'show_content' => 'excerpt', 'content_limit' => '', 'more_text' => __('[Read More...]', 'genesis'), 'extra_num' => '', 'extra_title' => '', 'more_from_category' => '', 'more_from_category_text' => __('More Posts from this Category', 'genesis'));
     $widget_ops = array('classname' => 'featured-content featuredpost', 'description' => __('Displays featured posts with thumbnails', 'genesis'));
     $control_ops = array('id_base' => 'featured-post', 'width' => 505, 'height' => 350);
     parent::__construct('featured-post', __('Genesis - Featured Posts', 'genesis'), $widget_ops, $control_ops);
 }
Example #24
0
 function __construct()
 {
     global $wp_version;
     $widget_ops = array('classname' => 'ebs_custom_widget', 'description' => __('EBS widget to show EBS/other shortcodes in sidebar.', 'ebs'));
     $control_ops = array('id_base' => 'ebsp-widget');
     parent::__construct('ebsp-widget', __('EBS Shortcode Compiler', 'ebs'), $widget_ops, $control_ops);
 }
 /**
  * Construct
  */
 function __construct()
 {
     $id_base = 'yith-vendor-store-location';
     $name = __('YITH Vendor Store Location', 'yith_wc_product_vendors');
     $widget_options = array('description' => __('Display the vendor\'s store location in Google Maps', 'yith_wc_product_vendors'));
     parent::__construct($id_base, $name, $widget_options);
 }
 /**
  * Constructor
  * 
  * @param $plugin
  */
 public function Pronamic_WP_PhotoContestPlugin_LatestEntriesWidget()
 {
     global $pronamic_photo_contest_plugin;
     $this->plugin = $pronamic_photo_contest_plugin;
     $this->widget_name = __('Latest Entries Widget', 'pronamic_photo_contest');
     parent::__construct(false, $this->widget_name, array('classname' => __CLASS__, 'description' => __('Shows the latest entry of a photo contest.', 'pronamic_photo_contest')));
 }
 /**
  * constructor
  */
 function HW_Taxonomy_Post_List_widget()
 {
     //Hoangweb Taxonomy Post List
     parent::WP_Widget(false, $name = "Truy xuất nội dung theo chuyên mục", array('description' => 'Hiển thị bài viết theo danh mục/taxonomy'));
     //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;
     }
     $this->setup_actions();
     //instance skin
     if (class_exists('HW_SKIN')) {
         $this->skin = new HW_SKIN($this, plugin_dir_path(__FILE__), self::SKINS_FOLDER, 'hw-category-posts.php', 'skins');
         //$this->skin->skin_name='hw-category-posts.php';   #/wp-contents/hw_yahooskype/yahooskype.php
         //$this->skin->skin_folder='wcp_hw_skins';   #create folder in /wp-contents/hw_yahooskype
         $this->skin->plugin_url = plugins_url('', __FILE__);
         $this->skin->enable_external_callback = false;
         $this->skin->create('pagination', '__paginations', 'hwtpl-pagination.php')->enable_external_callback = false;
         //create new skin for pagination
         //create scrollbar skins
         $this->skin->create('scrollbar', '__scrollbars', 'hwtpl-scrollbar.php')->enable_external_callback = false;
         $this->skin->enable_template_engine();
     }
     self::$instance = $this;
     //save lastest instance of this widget
     //register widget features from HW_AWC
     if (class_exists('HW_AWC')) {
         /*HW_AWC::register_widget_feature($this,'grid_posts');  //depricated
           HW_AWC::register_widget_feature($this, 'saveconfig');
           HW_AWC::register_widget_feature($this, 'fancybox');*/
     }
     $this->hwtpl = new HW_Taxonomy_Post_List();
     $this->hwtpl->localize_object_callback = array($this, '_set_localize_scripts_data');
 }
 /** 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();
     }
 }
Example #29
0
 /**
  * Constructor. Set the default widget options and create widget.
  */
 function __construct()
 {
     $this->defaults = array('title' => '', 'alignment' => 'left', 'user' => '', 'size' => '45', 'author_info' => '', 'bio_text' => '', 'page' => '', 'page_link_text' => __('Read More', 'genesis') . '&#x02026;', 'posts_link' => '');
     $widget_ops = array('classname' => 'user-profile', 'description' => __('Displays user profile block with Gravatar', 'genesis'));
     $control_ops = array('id_base' => 'user-profile', 'width' => 200, 'height' => 250);
     parent::__construct('user-profile', __('Genesis - User Profile', 'genesis'), $widget_ops, $control_ops);
 }
Example #30
0
 function mom_video_widgets()
 {
     $widget_ops = array('classname' => 'momiazat-videos', 'description' => __('Widget display video support Youtube, vimeo, dailymotion', 'framework'));
     /*		$control_ops = array( 'twitter name' => 'momizat', 'count' => 3, 'avatar_size' => '32' );
     */
     parent::__construct('momizar-videos', __('Momizat - Videos', 'framework'), $widget_ops);
 }