'Allinone_Mixed_Articles_Blocks', 'description' => esc_html__('Displays post form selected category in two Colum with list and grid', 'allinone'), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => esc_html__('Section Title for List:', 'allinone'), 'type' => 'text', 'class' => 'widefat', ), 'post_category_list' => array( 'label' => esc_html__('Select Category for List:', 'allinone'), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__('All Categories', 'allinone'), ), 'post_category_grid' => array( 'label' => esc_html__('Select Category for Grid:', 'allinone'), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__('All Categories', 'allinone'), ), '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, ), ); parent::__construct('allinone-double-cat-post-style', esc_html__('Allinone: Mixed Articles Blocks', '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']; $qargs_1 = array( 'post_type' => 'post', 'posts_per_page' => 5, 'post__not_in' => get_option("sticky_posts"), ); $cat_link = ""; if (absint($params['post_category_list']) > 0) { $qargs_1['cat'] = absint($params['post_category_list']); $cat_link = get_category_link($params['post_category_list']); } $qargs_2 = array( 'post_type' => 'post', 'posts_per_page' => 3, 'post__not_in' => get_option("sticky_posts"), ); $cat_link = ""; if (absint($params['post_category_grid']) > 0) { $qargs_2['cat'] = absint($params['post_category_grid']); $cat_link = get_category_link($params['post_category_grid']); } ?>

have_posts()) : ?>
have_posts()) : $style_1_posts_query->the_post(); ?>
have_posts()) : ?>
have_posts()) : $style_2_posts_query->the_post(); $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium_large'); $featured_image = isset($featured_image[0]) ? $featured_image[0] : ''; ?>