widget_cssclass = 'blogbend-tabbed-widget'; $this->widget_description = __('Displays posts in tab', 'blogbend'); $this->widget_id = 'blogbend_tab_posts'; $this->widget_name = __('BlogBend: Tab Posts', 'blogbend'); $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', 'blogbend'), ), 'show_popular_posts' => array( 'type' => 'checkbox', 'label' => __('Show Tab', 'blogbend'), 'std' => true, ), 'popular_post_desc' => array( 'type' => 'subtitle', 'label' => __('Will display post based on comments count', 'blogbend'), ), 'popular_posts_title' => array( 'type' => 'text', 'label' => __('Title', 'blogbend'), 'std' => __('Popular', 'blogbend'), 'desc' => __('Leave as it is to show default title or leave blank to only show icon', 'blogbend'), ), 'popular_post_cat' => array( 'type' => 'dropdown-taxonomies', 'label' => __('Select Category', 'blogbend'), 'desc' => __('Leave empty if you don\'t want the posts to be category specific', 'blogbend'), 'args' => array( 'taxonomy' => 'category', 'class' => 'widefat', 'hierarchical' => true, 'show_count' => 1, 'show_option_all' => __('— Select —', 'blogbend'), ), ), 'popular_post_offset' => array( 'type' => 'number', 'step' => 1, 'min' => 0, 'max' => '', 'std' => '', 'label' => __('Offset', 'blogbend'), 'desc' => __('Can be useful if you want to skip certain number of posts. Leave as 0 if you do not want to use it.', 'blogbend'), ), 'popular_post_orderby' => array( 'type' => 'select', 'std' => 'date', 'label' => __('Order By', 'blogbend'), 'options' => array( 'date' => __('Date', 'blogbend'), 'ID' => __('ID', 'blogbend'), 'title' => __('Title', 'blogbend'), 'rand' => __('Random', 'blogbend'), ), ), 'popular_post_order' => array( 'type' => 'select', 'std' => 'desc', 'label' => __('Order', 'blogbend'), 'options' => array( 'asc' => __('ASC', 'blogbend'), 'desc' => __('DESC', 'blogbend'), ), ), 'hot_post_settings' => array( 'type' => 'heading', 'label' => __('Hot Post Settings', 'blogbend'), ), 'show_hot_posts' => array( 'type' => 'checkbox', 'label' => __('Show Tab', 'blogbend'), 'std' => true, ), 'hot_posts_title' => array( 'type' => 'text', 'label' => __('Title', 'blogbend'), 'std' => __('Hot', 'blogbend'), 'desc' => __('Leave as it is to show default title or leave blank to only show icon', 'blogbend'), ), 'hot_post_cat' => array( 'type' => 'dropdown-taxonomies', 'label' => __('Select Category', 'blogbend'), 'desc' => __('Leave empty if you don\'t want the posts to be category specific', 'blogbend'), 'args' => array( 'taxonomy' => 'category', 'class' => 'widefat', 'hierarchical' => true, 'show_count' => 1, 'show_option_all' => __('— Select —', 'blogbend'), ), ), 'hot_post_offset' => array( 'type' => 'number', 'step' => 1, 'min' => 0, 'max' => '', 'std' => '', 'label' => __('Offset', 'blogbend'), 'desc' => __('Can be useful if you want to skip certain number of posts. Leave as 0 if you do not want to use it.', 'blogbend'), ), 'hot_post_orderby' => array( 'type' => 'select', 'std' => 'date', 'label' => __('Order By', 'blogbend'), 'options' => array( 'date' => __('Date', 'blogbend'), 'ID' => __('ID', 'blogbend'), 'title' => __('Title', 'blogbend'), 'rand' => __('Random', 'blogbend'), ), ), 'hot_post_order' => array( 'type' => 'select', 'std' => 'desc', 'label' => __('Order', 'blogbend'), 'options' => array( 'asc' => __('ASC', 'blogbend'), 'desc' => __('DESC', 'blogbend'), ), ), 'latest_post_settings' => array( 'type' => 'heading', 'label' => __('Latest Post Settings', 'blogbend'), ), 'show_latest_posts' => array( 'type' => 'checkbox', 'label' => __('Show Tab', 'blogbend'), 'std' => true, ), 'latest_posts_title' => array( 'type' => 'text', 'label' => __('Title', 'blogbend'), 'std' => __('Latest', 'blogbend'), 'desc' => __('Leave as it is to show default title or leave blank to only show icon', 'blogbend'), ), 'latest_post_cat' => array( 'type' => 'dropdown-taxonomies', 'label' => __('Select Category', 'blogbend'), 'desc' => __('Leave empty if you don\'t want the posts to be category specific', 'blogbend'), 'args' => array( 'taxonomy' => 'category', 'class' => 'widefat', 'hierarchical' => true, 'show_count' => 1, 'show_option_all' => __('— Select —', 'blogbend'), ), ), 'latest_post_offset' => array( 'type' => 'number', 'step' => 1, 'min' => 0, 'max' => '', 'std' => '', 'label' => __('Offset', 'blogbend'), 'desc' => __('Can be useful if you want to skip certain number of posts. Leave as 0 if you do not want to use it.', 'blogbend'), ), 'latest_post_orderby' => array( 'type' => 'select', 'std' => 'date', 'label' => __('Order By', 'blogbend'), 'options' => array( 'date' => __('Date', 'blogbend'), 'ID' => __('ID', 'blogbend'), 'title' => __('Title', 'blogbend'), 'rand' => __('Random', 'blogbend'), ), ), 'latest_post_order' => array( 'type' => 'select', 'std' => 'desc', 'label' => __('Order', 'blogbend'), 'options' => array( 'asc' => __('ASC', 'blogbend'), 'desc' => __('DESC', 'blogbend'), ), ), 'general_settings' => array( 'type' => 'heading', 'label' => __('General Settings', 'blogbend'), ), 'number' => array( 'type' => 'number', 'step' => 1, 'min' => 1, 'max' => '', 'std' => 5, 'label' => __('Number of posts to show', 'blogbend'), ), 'show_date' => array( 'type' => 'checkbox', 'label' => __('Show Date', 'blogbend'), 'std' => true, ), 'date_format' => array( 'type' => 'select', 'label' => __('Date Format', 'blogbend'), 'options' => array( 'time_ago' => __('Format 1', 'blogbend'), 'calendar' => __('Format 2', 'blogbend'), ), 'std' => 'format_2', ), 'display_date_option' => array( 'type' => 'select', 'label' => __('Date Option', 'blogbend'), 'options' => array( 'with_label' => __( 'With Label', 'blogbend' ), 'with_icon' => __( 'With Icon', 'blogbend' ), ), 'std' => 'with_icon', ), 'date_text' => array( 'type' => 'text', 'label' => __('Date Text', 'blogbend'), 'std' => __('By:', 'blogbend'), 'desc' => __('This only works when the "With Label" option is selected under "Date Option"', 'blogbend'), ), 'show_author' => array( 'type' => 'checkbox', 'label' => __('Show Author', 'blogbend'), 'std' => false, ), 'display_author_option' => array( 'type' => 'select', 'label' => __('Author Option', 'blogbend'), 'options' => array( 'with_label' => __('With Label', 'blogbend'), 'with_icon' => __('With Icon', 'blogbend'), 'with_avatar_image' => __('With Avatar Image', 'blogbend'), ), 'std' => 'with_icon', ), 'author_text' => array( 'type' => 'text', 'label' => __('Author Text', 'blogbend'), 'std' => __('By:', 'blogbend'), 'desc' => __('This only works when the "With Label" option is selected under "Author Option"', 'blogbend'), ), 'show_category' => array( 'type' => 'checkbox', 'label' => __('Show Category', 'blogbend'), 'std' => true, ), 'category_text' => array( 'type' => 'text', 'label' => __('Category Text', 'blogbend'), ), 'display_category_option' => array( 'type' => 'select', 'label' => __('Category Option', 'blogbend'), 'options' => array( 'none' => __('None', 'blogbend'), 'has-background' => __('Has background', 'blogbend'), 'has-text-color' => __('Has text color', 'blogbend'), ), 'std' => 'has-text-color', ), 'number_of_cat' => array( 'type' => 'number', 'step' => 1, 'min' => 1, 'std' => 1, 'label' => __('Number of Category to show', 'blogbend'), ), 'tab_display_style' => array( 'type' => 'select', 'label' => __('Display Style', 'blogbend'), 'options' => array( 'wpmotif-default-post' => __('Regular View', 'blogbend'), 'wpmotif-list-post' => __('List View', 'blogbend'), 'wpmotif-card-post' => __('Card View', 'blogbend'), ), 'std' => 'wpmotif-list-post', ), 'show_post_counter' => array( 'type' => 'checkbox', 'label' => __('Show Counter', 'blogbend'), 'std' => true, ), 'show_image' => array( 'type' => 'checkbox', 'label' => __('Show Image', 'blogbend'), 'std' => true, ), 'image_size' => array( 'type' => 'select', 'label' => __('Image size', 'blogbend'), 'options' => array( 'thumbnail' => __('Thumbnail', 'blogbend'), 'medium' => __('Medium', 'blogbend'), 'medium_large' => __('Medium Large', 'blogbend'), 'large' => __('Large', 'blogbend'), ), 'std' => 'thumbnail', ), 'font_size' => array( 'type' => 'select', 'label' => __('Entry title font size', 'blogbend'), 'options' => array( 'entry-title-xs' => __('Extra Small', 'blogbend'), 'entry-title-small' => __('Small', 'blogbend'), 'entry-title-medium' => __('Medium', 'blogbend'), 'entry-title-big' => __('Big', 'blogbend'), ), 'std' => 'entry-title-xs', ), 'font_style' => array( 'type' => 'select', 'label' => __('Entry title font style', 'blogbend'), 'options' => array( 'entry-title-normal' => __('Normal', 'blogbend'), 'entry-title-italic' => __('Italic', 'blogbend'), ), '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']; ?>