start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'best-hotel' ), ] ); $this->add_responsive_control( 'columns', [ 'label' => __( 'Columns', 'best-hotel' ), 'type' => Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '2', 'mobile_default' => '1', 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', ], 'prefix_class' => 'elementor-grid%s-', 'frontend_available' => true, 'selectors' => [ '.elementor-msie {{WRAPPER}} .elementor-portfolio-item' => 'width: calc( 100% / {{SIZE}} )', ], ] ); $this->add_control( 'posts_per_page', [ 'label' => __( 'Posts Per Page', 'best-hotel' ), 'type' => Controls_Manager::NUMBER, 'default' => 3, ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'post_thumbnail', 'exclude' => [ 'custom' ], 'default' => 'large', 'prefix_class' => 'post-thumbnail-size-', ] ); $this->add_control( 'show_excerpt', [ 'label' => __( 'Excerpt', 'best-hotel' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'best-hotel' ), 'label_off' => __( 'Hide', 'best-hotel' ), 'default' => 'yes', 'return_value' => 'yes', 'separator' => 'before', ] ); $this->add_control( 'excerpt_length', [ 'label' => __( 'Excerpt Length', 'best-hotel' ), 'type' => Controls_Manager::NUMBER, 'default' => 25, 'condition' => [ 'show_excerpt' => 'yes', ], ] ); $this->add_control( 'read_more_text', [ 'label' => __( 'Read More Text', 'best-hotel' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Read More', 'best-hotel' ), ] ); $this->end_controls_section(); } /** * Render the widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); ?>
absint( $posts_per_page ), 'no_found_rows' => true, 'ignore_sticky_posts' => true, 'post_type' => 'post', 'post_status' => 'publish', ); ?> have_posts() ) : while ( $all_posts->have_posts() ) : $all_posts->the_post(); ?>
>
<?php the_title_attribute(); ?>