'widget_thrive_tabs', 'description' => __( 'Up to 3 tabs with lists of posts or pages.', 'thrive' ) ); parent::__construct( 'widget_thrive_tabs', __( 'Thrive Tabs Widget', 'thrive' ), $widget_ops ); $this->alt_option_name = 'widget_thrive_tabs'; 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' ) ); add_action( 'wp_footer', array( &$this, '_js' ) ); } function widget( $args, $instance ) { if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = "widget-thrive" . rand( 0, 999 ); } //by default the display of the post date should be on $instance['display_post_date'] = ( isset( $instance['display_post_date'] ) ) ? $instance['display_post_date'] : "on"; $instance['display_no_comments'] = ( isset( $instance['display_no_comments'] ) ) ? $instance['display_no_comments'] : "on"; $tabs_contents = $this->_build_tab_widget_contents( $instance ); $txt_class = ( $instance['thumbnail_size'] == "on" ) ? "" : " noImageTab"; ?> flush_widget_cache(); $alloptions = wp_cache_get( 'alloptions', 'options' ); if ( isset( $alloptions['widget_thrive_tabs'] ) ) { delete_option( 'widget_thrive_tabs' ); } return $instance; } function flush_widget_cache() { wp_cache_delete( 'widget_thrive_tabs', 'widget' ); } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'display_post_date' => 'on', 'display_no_comments' => 'on' ) ); $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; $trending_label = isset( $instance['trending_label'] ) ? esc_attr( $instance['trending_label'] ) : ''; $alltime_label = isset( $instance['alltime_label'] ) ? esc_attr( $instance['alltime_label'] ) : ''; $recent_label = isset( $instance['recent_label'] ) ? esc_attr( $instance['recent_label'] ) : ''; $category_label = isset( $instance['category_label'] ) ? esc_attr( $instance['category_label'] ) : ''; $custom_label = isset( $instance['custom_label'] ) ? esc_attr( $instance['custom_label'] ) : ''; $no_items_show = isset( $instance['no_items_show'] ) ? absint( $instance['no_items_show'] ) : 0; $thumbnail_size = isset( $instance['thumbnail_size'] ) ? ( $instance['thumbnail_size'] ) : ""; $trending_time = isset( $instance['trending_time'] ) ? absint( $instance['trending_time'] ) : 0; $display_post_date = isset( $instance['display_post_date'] ) ? ( $instance['display_post_date'] ) : "off"; $display_no_comments = isset( $instance['display_no_comments'] ) ? ( $instance['display_no_comments'] ) : "off"; $show_tabs_trending = isset( $instance['show_tabs_trending'] ) ? ( $instance['show_tabs_trending'] ) : ""; $show_tabs_popular = isset( $instance['show_tabs_popular'] ) ? ( $instance['show_tabs_popular'] ) : ""; $show_tabs_recent = isset( $instance['show_tabs_recent'] ) ? ( $instance['show_tabs_recent'] ) : ""; $show_tabs_category = isset( $instance['show_tabs_category'] ) ? ( $instance['show_tabs_category'] ) : ""; $show_tabs_menu = isset( $instance['show_tabs_menu'] ) ? ( $instance['show_tabs_menu'] ) : ""; $category = isset( $instance['category'] ) ? absint( $instance['category'] ) : 0; $mymenu = isset( $instance['menu'] ) ? absint( $instance['menu'] ) : 0; $first_tab = isset( $instance['first_tab'] ) ? $instance['first_tab'] : ""; $all_menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); $menus_array = array(); foreach ( $all_menus as $menu ) { array_push( $menus_array, array( 'id' => $menu->term_id, 'name' => $menu->name ) ); } $all_categories = get_categories(); $categories_array = array(); foreach ( $all_categories as $cat ) { array_push( $categories_array, array( 'id' => $cat->cat_ID, 'name' => $cat->cat_name ) ); } ?>
checked="checked" class="thrive_chk_show_thumbnail"/>
checked="checked" class="thrive_chk_display_post_date" value="on"/>
checked="checked" class="thrive_chk_display_no_comments" value="on"/>
checked="checked"
class="thrive_chk_show_tabs thrive_chk_show_trending"/>
checked
class="thrive_chk_show_tabs thrive_chk_show_popular"/>
checked
class="thrive_chk_show_tabs thrive_chk_show_recent"/>
checked
class="thrive_chk_show_tabs thrive_chk_show_category"/>
checked
class="thrive_chk_show_tabs thrive_chk_show_menu"/>