add_control( 'enable_post_excerpt', [ 'type' => \Elementor\Controls_Manager::SWITCHER, 'label' => esc_html__('Post Excerpt', 'bloglex'), 'default' => 'yes', ] ); $this->add_control( 'post_line_limit', [ 'type' => \Elementor\Controls_Manager::SELECT, 'label' => esc_html__('Content Line Limit', 'bloglex'), 'options' => [ 'limit-line-1' => esc_html__( '1 Line', 'bloglex' ), 'limit-line-2' => esc_html__( '2 Lines', 'bloglex' ), 'limit-line-3' => esc_html__( '3 Lines', 'bloglex' ), 'limit-line-4' => esc_html__( '4 Lines', 'bloglex' ), 'limit-line-5' => esc_html__( '5 Lines', 'bloglex' ), ], 'default' => 'limit-line-3', ] ); } /** * Retrieve Bloglex_Elementor_Widgets_Block_4 widget icon. * * @access public * * @return string Widget icon. */ public function get_icon() { return 'bloglex-econs-block-4'; } /** * Retrieve the list of categories the Bloglex_Elementor_Widgets_Block_4 widget belongs to. * * Used to determine where to display the widget in the editor. * * @access public * * @return array Widget categories. */ public function get_categories() { return array('bloglex-widget-blocks'); } /** * Render Bloglex_Elementor_Widgets_Block_4 widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @access protected */ protected function render() { $widget_title = $this->get_settings('widget_title'); $posts_number = $this->get_settings('posts_number'); $enable_post_excerpt = $this->get_settings('enable_post_excerpt'); $post_line_limit = $this->get_settings('post_line_limit'); $enable_category_meta = $this->get_settings('enable_category_meta'); $category_meta_text = $this->get_settings('category_meta_text'); $display_category_option = $this->get_settings('display_category_option'); $number_of_cat = $this->get_settings('number_of_cat'); $enable_author_meta = $this->get_settings('enable_author_meta'); $display_author_option = $this->get_settings('display_author_option'); $author_text = $this->get_settings('author_text'); $enable_date_meta = $this->get_settings('enable_date_meta'); $date_format = $this->get_settings('date_format'); $display_type = $this->get_settings('display_type'); $offset_posts_number = $this->get_settings('offset_posts_number'); $categories_selected = $this->get_settings('categories_selected'); // Create the posts query. $get_featured_posts = $this->query_posts($posts_number, $display_type, $categories_selected, $offset_posts_number); ?>
widget_title($widget_title); while ($get_featured_posts->have_posts()) : $get_featured_posts->the_post(); $featured_image_size = 'medium_large'; ?>
>
the_post_thumbnail($featured_image_size); ?>
the_title($font_class); ?>