'afwp_tab_widget', 'description' => esc_html__( 'Widget for Tab', 'accordion-for-wp' ), 'customize_selective_refresh' => true, ); $control_ops = array( 'width' => 350, 'height' => 350 ); parent::__construct( 'afwp_tab_widget', esc_html__( 'Tab Post Widget', 'accordion-for-wp' ), $widget_ops, $control_ops ); } /** * Outputs the content for the current Accordion widget instance. * * @since 1.1.0 * @access public * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance Settings for the current Accordion widget instance. */ public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $post_type = ! empty( $instance['post_type'] ) ? esc_attr($instance['post_type']) : ''; $taxonomy = ! empty( $instance['taxonomy'] ) ? esc_attr($instance['taxonomy']) : ''; $term = ! empty( $instance['term'] ) ? esc_attr($instance['term']) : ''; $no_of_post = ! empty( $instance['no_of_post'] ) ? absint($instance['no_of_post']) : ''; $tab_icon = isset($instance['tab_icon']) ? esc_attr( $instance['tab_icon'] ) : 'fa-desktop'; $title_color = isset($instance['title_color']) ? sanitize_hex_color( $instance['title_color'] ) : ''; $title_background = isset($instance['title_background']) ? sanitize_hex_color( $instance['title_background'] ) : ''; $title_wraper_bg = isset($instance['title_wraper_bg']) ? sanitize_hex_color( $instance['title_wraper_bg'] ) : ''; $content_color = isset($instance['content_color']) ? sanitize_hex_color( $instance['content_color'] ) : ''; $content_background = isset($instance['content_background']) ? sanitize_hex_color( $instance['content_background'] ) : ''; $content_wraper_bg = isset($instance['content_wraper_bg']) ? sanitize_hex_color( $instance['content_wraper_bg'] ) : ''; $templates = empty( $instance['templates'] ) ? 'default' : esc_attr($instance['templates']); $style = empty( $instance['style'] ) ? 'vertical' : esc_attr($instance['style']); $active_item = isset( $instance['active_item'] ) ? absint($instance['active_item']) : 1; $content_type = ! empty( $instance['content_type'] ) ? esc_attr($instance['content_type']) : 'excerpt'; echo $args['before_widget']; if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } $wp_args = array( 'post_type' => $post_type, 'posts_per_page' => $no_of_post, ); if ( $taxonomy && $term ) { $wp_args['tax_query'] = array( array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $term, ) ); } $query = new WP_Query( $wp_args ); if ( $query->have_posts() ): ?>
'', 'post_type' => '', 'taxonomy' => '', 'term' => '', 'no_of_post' => '5', 'content_type' =>'excerpt', 'templates' => 'default', 'style' => 'vertical', 'active_item' => 1, 'tab_icon' => 'fa-desktop', 'title_color' => '', 'title_background' => '', 'title_wraper_bg' => '', 'content_color' => '', 'content_background'=> '', 'content_wraper_bg' => '', 'active_tab_type' =>'general', ) ); $title = isset($instance['title']) ? sanitize_text_field( $instance['title'] ) : ''; $post_type = isset($instance['post_type']) ? esc_attr( $instance['post_type'] ) : ''; $taxonomy = isset($instance['taxonomy']) ? esc_attr( $instance['taxonomy'] ) : ''; $term = isset($instance['term']) ? esc_attr( $instance['term'] ) : ''; $no_of_post = isset($instance['no_of_post']) ? absint( $instance['no_of_post'] ) : ''; $content_type = isset($instance['content_type']) ? esc_attr( $instance['content_type'] ) : ''; $templates = isset($instance['templates']) ? esc_attr( $instance['templates'] ) : ''; $style = isset($instance['style']) ? esc_attr( $instance['style'] ) : ''; $active_item = isset($instance['active_item']) ? esc_attr( $instance['active_item'] ) : ''; $tab_icon = isset($instance['tab_icon']) ? esc_attr( $instance['tab_icon'] ) : 'fa-desktop'; $title_color = isset($instance['title_color']) ? esc_attr( $instance['title_color'] ) : ''; $title_background = isset($instance['title_background']) ? esc_attr( $instance['title_background'] ) : ''; $title_wraper_bg = isset($instance['title_wraper_bg']) ? esc_attr( $instance['title_wraper_bg'] ) : ''; $content_color = isset($instance['content_color']) ? esc_attr( $instance['content_color'] ) : ''; $content_background = isset($instance['content_background']) ? esc_attr( $instance['content_background'] ) : ''; $content_wraper_bg = isset($instance['content_wraper_bg']) ? esc_attr( $instance['content_wraper_bg'] ) : ''; $active_tab_type = isset($instance['active_tab_type']) ? esc_attr( $instance['active_tab_type'] ) : 'general'; $list_all_tabs = array( 'general' => array( 'id' => 'afwp_tab_widget_general'.esc_attr($this->number), 'label' => esc_html__('General', 'accordion-for-wp'), ), 'layout' => array( 'id' => 'afwp_tab_widget_layout'.esc_attr($this->number), 'label' => esc_html__('Layout', 'accordion-for-wp'), ), 'design' => array( 'id' => 'afwp_tab_widget_design'.esc_attr($this->number), 'label' => esc_html__('Design', 'accordion-for-wp'), ), ); ?>
true, ); $all_post_types = get_post_types( $args, 'objects' ); ?>
$taxonomy, 'hide_empty' => false, ) ); ?>
esc_html__('Short Description', 'accordion-for-wp'), 'content' => esc_html__('Full Content','accordion-for-wp'), ); ?>