'primebulletin_category_post_widget', 'description' => esc_html__('Displays post form selected category specific for popular post in sidebars.', 'primebulletin'), 'customize_selective_refresh' => true, ); $fields = array( 'title_1' => array( 'label' => esc_html__('Title 1:', 'primebulletin'), 'type' => 'text', 'class' => 'widefat', 'default' => esc_html__('Category 1', 'primebulletin'), ), 'post_category_1' => array( 'label' => esc_html__('Select Category 1:', 'primebulletin'), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__('All Categories', 'primebulletin'), ), 'title_2' => array( 'label' => esc_html__('Title 2:', 'primebulletin'), 'type' => 'text', 'class' => 'widefat', 'default' => esc_html__('Category 2', 'primebulletin'), ), 'post_category_2' => array( 'label' => esc_html__('Select Category 2:', 'primebulletin'), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__('All Categories', 'primebulletin'), ), 'title_3' => array( 'label' => esc_html__('Title 3:', 'primebulletin'), 'type' => 'text', 'class' => 'widefat', 'default' => esc_html__('Category 3', 'primebulletin'), ), 'post_category_3' => array( 'label' => esc_html__('Select Category 3:', 'primebulletin'), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__('All Categories', 'primebulletin'), ), 'post_number' => array( 'label' => esc_html__('Number of Posts:', 'primebulletin'), 'type' => 'number', 'default' => 4, 'css' => 'max-width:60px;', 'min' => 1, 'max' => 7, ), 'column_number' => array( 'label' => esc_html__('Number of Column:', 'primebulletin'), 'type' => 'select', 'default' => '3', 'options' => array( '2' => esc_html__('2', 'primebulletin'), '3' => esc_html__('3', 'primebulletin'), ), ), ); parent::__construct('PrimeBulletin-category-posts', esc_html__('PrimeBulletin: Layout Multiple Panel', 'primebulletin'), $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 = isset($params['post_number']) ? $params['post_number'] : ''; $column_number = isset($params['column_number']) ? $params['column_number'] : ''; if ($column_number == '2') { $column_class = 6; } else { $column_class = 4; } ?>
'post', 'posts_per_page' => $post_number, 'post__not_in' => get_option("sticky_posts"), 'cat' => esc_html($section_category))); if ( $section_category && $category_post_query->have_posts() ): ?>
' . esc_html($params['title_' . $x]) . '' . $args['after_title']; }else{ echo $args['before_title'] . '' . esc_html($cat_name) . '' . $args['after_title']; } ?>
have_posts()) { $category_post_query->the_post(); if ($post_count == 1) { $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'primebulletin-550-400'); $featured_image = isset( $featured_image[0] ) ? $featured_image[0] : ''; ?>
>

'; echo esc_html( wp_trim_words( get_the_content(),20,'...' ) ); echo '

'; } ?>