widget_cssclass = 'bloglex-tabbed-widget'; $this->widget_description = __('Displays posts in tab', 'bloglex'); $this->widget_id = 'bloglex_tab_posts'; $this->widget_name = __('Bloglex: Tab Posts', 'bloglex'); $this->settings = $this->get_widget_settings(); parent::__construct(); } /** * Define widget settings. */ protected function get_widget_settings() { return array( 'popular_post_settings' => array( 'type' => 'heading', 'label' => __('Popular Post Settings', 'bloglex'), ), 'show_popular_posts' => array( 'type' => 'checkbox', 'label' => __('Show Tab', 'bloglex'), 'std' => true, ), 'popular_post_desc' => array( 'type' => 'subtitle', 'label' => __('Will display post based on comments count', 'bloglex'), ), 'popular_posts_title' => array( 'type' => 'text', 'label' => __('Title', 'bloglex'), 'std' => __('Popular', 'bloglex'), 'desc' => __('Leave as it is to show default title or leave blank to only show icon', 'bloglex'), ), 'popular_post_cat' => array( 'type' => 'dropdown-taxonomies', 'label' => __('Select Category', 'bloglex'), 'desc' => __('Leave empty if you don\'t want the posts to be category specific', 'bloglex'), 'args' => array( 'taxonomy' => 'category', 'class' => 'widefat', 'hierarchical' => true, 'show_count' => 1, 'show_option_all' => __('— Select —', 'bloglex'), ), ), 'popular_post_offset' => array( 'type' => 'number', 'step' => 1, 'min' => 0, 'max' => '', 'std' => '', 'label' => __('Offset', 'bloglex'), 'desc' => __('Can be useful if you want to skip certain number of posts. Leave as 0 if you do not want to use it.', 'bloglex'), ), 'popular_post_orderby' => array( 'type' => 'select', 'std' => 'date', 'label' => __('Order By', 'bloglex'), 'options' => array( 'date' => __('Date', 'bloglex'), 'ID' => __('ID', 'bloglex'), 'title' => __('Title', 'bloglex'), 'rand' => __('Random', 'bloglex'), ), ), 'popular_post_order' => array( 'type' => 'select', 'std' => 'desc', 'label' => __('Order', 'bloglex'), 'options' => array( 'asc' => __('ASC', 'bloglex'), 'desc' => __('DESC', 'bloglex'), ), ), 'hot_post_settings' => array( 'type' => 'heading', 'label' => __('Hot Post Settings', 'bloglex'), ), 'show_hot_posts' => array( 'type' => 'checkbox', 'label' => __('Show Tab', 'bloglex'), 'std' => true, ), 'hot_posts_title' => array( 'type' => 'text', 'label' => __('Title', 'bloglex'), 'std' => __('Hot', 'bloglex'), 'desc' => __('Leave as it is to show default title or leave blank to only show icon', 'bloglex'), ), 'hot_post_cat' => array( 'type' => 'dropdown-taxonomies', 'label' => __('Select Category', 'bloglex'), 'desc' => __('Leave empty if you don\'t want the posts to be category specific', 'bloglex'), 'args' => array( 'taxonomy' => 'category', 'class' => 'widefat', 'hierarchical' => true, 'show_count' => 1, 'show_option_all' => __('— Select —', 'bloglex'), ), ), 'hot_post_offset' => array( 'type' => 'number', 'step' => 1, 'min' => 0, 'max' => '', 'std' => '', 'label' => __('Offset', 'bloglex'), 'desc' => __('Can be useful if you want to skip certain number of posts. Leave as 0 if you do not want to use it.', 'bloglex'), ), 'hot_post_orderby' => array( 'type' => 'select', 'std' => 'date', 'label' => __('Order By', 'bloglex'), 'options' => array( 'date' => __('Date', 'bloglex'), 'ID' => __('ID', 'bloglex'), 'title' => __('Title', 'bloglex'), 'rand' => __('Random', 'bloglex'), ), ), 'hot_post_order' => array( 'type' => 'select', 'std' => 'desc', 'label' => __('Order', 'bloglex'), 'options' => array( 'asc' => __('ASC', 'bloglex'), 'desc' => __('DESC', 'bloglex'), ), ), 'latest_post_settings' => array( 'type' => 'heading', 'label' => __('Latest Post Settings', 'bloglex'), ), 'show_latest_posts' => array( 'type' => 'checkbox', 'label' => __('Show Tab', 'bloglex'), 'std' => true, ), 'latest_posts_title' => array( 'type' => 'text', 'label' => __('Title', 'bloglex'), 'std' => __('Latest', 'bloglex'), 'desc' => __('Leave as it is to show default title or leave blank to only show icon', 'bloglex'), ), 'latest_post_cat' => array( 'type' => 'dropdown-taxonomies', 'label' => __('Select Category', 'bloglex'), 'desc' => __('Leave empty if you don\'t want the posts to be category specific', 'bloglex'), 'args' => array( 'taxonomy' => 'category', 'class' => 'widefat', 'hierarchical' => true, 'show_count' => 1, 'show_option_all' => __('— Select —', 'bloglex'), ), ), 'latest_post_offset' => array( 'type' => 'number', 'step' => 1, 'min' => 0, 'max' => '', 'std' => '', 'label' => __('Offset', 'bloglex'), 'desc' => __('Can be useful if you want to skip certain number of posts. Leave as 0 if you do not want to use it.', 'bloglex'), ), 'latest_post_orderby' => array( 'type' => 'select', 'std' => 'date', 'label' => __('Order By', 'bloglex'), 'options' => array( 'date' => __('Date', 'bloglex'), 'ID' => __('ID', 'bloglex'), 'title' => __('Title', 'bloglex'), 'rand' => __('Random', 'bloglex'), ), ), 'latest_post_order' => array( 'type' => 'select', 'std' => 'desc', 'label' => __('Order', 'bloglex'), 'options' => array( 'asc' => __('ASC', 'bloglex'), 'desc' => __('DESC', 'bloglex'), ), ), 'general_settings' => array( 'type' => 'heading', 'label' => __('General Settings', 'bloglex'), ), 'number' => array( 'type' => 'number', 'step' => 1, 'min' => 1, 'max' => '', 'std' => 5, 'label' => __('Number of posts to show', 'bloglex'), ), 'date_format' => array( 'type' => 'select', 'label' => __('Date Format', 'bloglex'), 'desc' => __('Make sure to select Date from above for this to work.', 'bloglex'), 'options' => array( 'format_1' => __('Times Ago', 'bloglex'), 'format_2' => __('Default Format', 'bloglex'), ), 'std' => 'format_2', ), 'show_category' => array( 'type' => 'checkbox', 'label' => __('Show Category', 'bloglex'), 'std' => true, ), 'category_text' => array( 'type' => 'text', 'label' => __('Category Text', 'bloglex'), ), 'display_category_option' => array( 'type' => 'select', 'label' => __('Category Option', 'bloglex'), 'options' => array( 'none' => __('None', 'bloglex'), 'has-background' => __('Has dot', 'bloglex'), 'has-text-color' => __('Has text color', 'bloglex'), ), 'std' => 'has-text-color', ), 'number_of_cat' => array( 'type' => 'number', 'step' => 1, 'min' => 1, 'std' => 1, 'label' => __('Number of Category to show', 'bloglex'), ), 'tab_display_style' => array( 'type' => 'select', 'label' => __('Display Style', 'bloglex'), 'options' => array( 'wpi-post-regular' => __('Regular View', 'bloglex'), 'wpi-post-list' => __('List View', 'bloglex'), 'wpi-post-card' => __('Card View', 'bloglex'), ), 'std' => 'wpi-post-list', ), 'show_counter' => array( 'type' => 'checkbox', 'label' => __('Show Counter', 'bloglex'), 'std' => true, ), 'show_image' => array( 'type' => 'checkbox', 'label' => __('Show Image', 'bloglex'), 'std' => true, ), 'image_size' => array( 'type' => 'select', 'label' => __('Image size', 'bloglex'), 'options' => array( 'thumbnail' => __('Thumbnail', 'bloglex'), 'medium' => __('Medium', 'bloglex'), 'medium_large' => __('Medium Large', 'bloglex'), 'large' => __('Large', 'bloglex'), ), 'std' => 'thumbnail', ), 'image_hover_effects' => array( 'type' => 'select', 'label' => __('Image hover effects', 'bloglex'), 'options' => array( 'hover-effect-shine' => __('Shine', 'bloglex'), 'hover-effect-slide' => __('Slide', 'bloglex'), 'hover-effect-zoom' => __('Zoom', 'bloglex'), ), 'std' => 'hover-effect-shine', ), 'font_size' => array( 'type' => 'select', 'label' => __('Entry title font size', 'bloglex'), 'options' => array( 'entry-title-xsmall' => __('Extra Small', 'bloglex'), 'entry-title-small' => __('Small', 'bloglex'), 'entry-title-medium' => __('Medium', 'bloglex'), 'entry-title-big' => __('Big', 'bloglex'), ), 'std' => 'entry-title-small', ), 'font_style' => array( 'type' => 'select', 'label' => __('Entry title font style', 'bloglex'), 'options' => array( 'entry-title-normal' => __('Normal', 'bloglex'), 'entry-title-italic' => __('Italic', 'bloglex'), ), 'std' => 'entry-title-normal', ), ); } /** * Outputs the tab Content * * @param array $instance * @param string $block The block to display. */ public function render_tab_title($instance, $block, $is_active = false) { if (!$block) { return; } $enabled = isset($instance["show_{$block}_posts"]) ? $instance["show_{$block}_posts"] : $this->settings["show_{$block}_posts"]['std']; if ($enabled) : $title = isset($instance["{$block}_posts_title"]) ? $instance["{$block}_posts_title"] : $this->settings["{$block}_posts_title"]['std']; ?>