'allinone_post_carousel_widget', 'description' => esc_html__('Displays post form selected category in carousel styles', 'allinone'), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => esc_html__('Section Title:', 'allinone'), 'type' => 'text', 'class' => 'widefat', ), 'post_category' => array( 'label' => esc_html__('Select Category:', 'allinone'), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__('All Categories', 'allinone'), ), 'post_number' => array( 'label' => esc_html__('Number of posts to show:', 'allinone'), 'type' => 'number', 'default' => 5, 'css' => 'max-width:60px;', 'min' => 1, 'max' => 10, ), 'enable_meta' => array( 'label' => esc_html__('Enable Categories:', 'allinone'), 'type' => 'checkbox', 'default' => true, ), 'enable_meta_1' => array( 'label' => esc_html__('Enable Date & Author:', 'allinone'), 'type' => 'checkbox', 'default' => true, ), 'button_text' => array( 'label' => esc_html__('Button Text:', 'allinone'), 'type' => 'text', 'default' => 'View more', 'class' => 'widefat', ), ); parent::__construct('allinone-widget-carousel-style', esc_html__('Allinone: Carousel Widget', 'allinone'), $opts, array(), $fields); } /** * Outputs the content for the current widget instance. * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. * @since 1.0.0 * */ function widget($args, $instance) { $params = $this->get_params($instance); echo $args['before_widget']; $post_number = $params['post_number']; $qargs = array( 'post_type' => 'post', 'posts_per_page' => $post_number, 'post__not_in' => get_option("sticky_posts"), ); $cat_link = ""; if( is_rtl() ) { $rtl = 'true'; }else{ $rtl = 'false'; } if (absint($params['post_category']) > 0) { $qargs['cat'] = absint($params['post_category']); $cat_link = get_category_link($params['post_category']); } $style_1_posts_query = new WP_Query($qargs); if ($style_1_posts_query->have_posts()) : ?>