set_settings(); $widget_ops = [ 'classname' => 'fusion-tabs-widget', 'description' => __( 'Popular posts, recent post and comments.', 'Avada' ), ]; $control_ops = [ 'id_base' => 'pyre_tabs-widget', ]; parent::__construct( 'pyre_tabs-widget', __( 'Avada: Tabs', 'Avada' ), $widget_ops, $control_ops ); $this->enqueue_script(); } /** * Set settings for this widget, * with a fallback to some sane defaults if no customized settings are saved in the database. * * @access public * @since 4.0 * @return void */ public function set_settings() { $fusion_settings = class_exists( 'Fusion_Settings' ) ? awb_get_fusion_settings() : false; if ( $fusion_settings ) { $date_format = $fusion_settings->get( 'date_format' ); $date_format = $date_format ? $date_format : get_option( 'date_format' ); $this->settings = [ 'alternate_date_format_day' => $fusion_settings->get( 'alternate_date_format_day' ), 'alternate_date_format_month_year' => $fusion_settings->get( 'alternate_date_format_month_year' ), 'date_format' => $date_format, ]; } else { $this->settings = [ 'alternate_date_format_day' => 'j', 'alternate_date_format_month_year' => 'm, Y', 'date_format' => get_option( 'date_format' ), ]; } } /** * Echoes the widget content. * * @access public * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance The settings for the particular instance of the widget. */ public function widget( $args, $instance ) { global $post; extract( $args ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract $design_tabs = isset( $instance['design_tabs'] ) ? $instance['design_tabs'] : 'classic'; $design_posts = isset( $instance['design_posts'] ) ? $instance['design_posts'] : 'image_default'; $posts = isset( $instance['posts'] ) ? $instance['posts'] : 3; $comments = isset( $instance['comments'] ) ? $instance['comments'] : '3'; $tags_count = isset( $instance['tags'] ) ? $instance['tags'] : 3; $show_popular_posts = isset( $instance['show_popular_posts'] ) && 'on' === $instance['show_popular_posts'] ? true : false; $show_recent_posts = isset( $instance['show_recent_posts'] ) && 'on' === $instance['show_recent_posts'] ? true : false; $show_comments = isset( $instance['show_comments'] ) && 'on' === $instance['show_comments'] ? true : false; $count_tabs = (int) $show_popular_posts + (int) $show_recent_posts + (int) $show_comments; if ( isset( $instance['orderby'] ) ) { $orderby = $instance['orderby']; } else { $orderby = 'comment_count'; } echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput ?>
'classic', 'design_posts' => 'image_default', 'posts' => 3, 'comments' => '3', 'tags' => 3, 'show_popular_posts' => 'on', 'show_recent_posts' => 'on', 'show_comments' => 'on', 'orderby' => 'comments_count', ]; $instance = wp_parse_args( (array) $instance, $defaults ); if ( 'Highest Comments' === $instance['orderby'] || 'comment_count' === $instance['orderby'] ) { $instance['orderby'] = 'comment_count'; } else { $instance['orderby'] = 'view_count'; } ?>
id="get_field_id( 'show_popular_posts' ) ); ?>" name="get_field_name( 'show_popular_posts' ) ); ?>" />
id="get_field_id( 'show_recent_posts' ) ); ?>" name="get_field_name( 'show_recent_posts' ) ); ?>" />
id="get_field_id( 'show_comments' ) ); ?>" name="get_field_name( 'show_comments' ) ); ?>" />
$comments, 'status' => 'approve', 'post_status' => 'publish', ] ); ?>-
comment_content ), 12 ); // phpcs:ignore WordPress.Security.EscapeOutput, WordPress.WP.AlternativeFunctions ?>
comment_author ) ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions ?>