start_controls_section( 'content_section', [ 'label' => __( 'Content', 'mfn-opts' ), ] ); $this->add_control( 'title', [ 'label' => __( 'Title', 'mfn-opts' ), 'type' => \Elementor\Controls_Manager::TEXT, 'label_block' => true, 'default' => __( 'This is the heading', 'mfn-opts' ), ] ); $this->add_control( 'title_tag', [ 'label' => __( 'Title | Tag', 'mfn-opts' ), 'description' => __( 'Title tag for 1st item, others use a smaller one', 'mfn-opts' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => array( 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', ), 'default' => 'h3', ] ); $this->end_controls_section(); $this->start_controls_section( 'options_section', [ 'label' => __( 'Options', 'mfn-opts' ), ] ); $this->add_control( 'category', [ 'label' => __( 'Category', 'mfn-opts' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => mfn_get_categories('category'), 'default' => "", ] ); $this->add_control( 'category_multi', [ 'label' => __( 'Multiple Categories', 'mfn-opts' ), 'description' => __('Slugs should be separated with coma ( , )', 'mfn-opts'), 'type' => \Elementor\Controls_Manager::TEXT, 'label_block' => true, ] ); $this->add_control( 'orderby', [ 'label' => __( 'Order by', 'mfn-opts' ), 'description' => __('Do not use random order with pagination or load more', 'mfn-opts'), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => array( 'date' => __('Date', 'mfn-opts'), 'title' => __('Title', 'mfn-opts'), 'rand' => __('Random', 'mfn-opts'), ), 'default' => "date", ] ); $this->add_control( 'order', [ 'label' => __( 'Order', 'mfn-opts' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => array( 'ASC' => __('Ascending', 'mfn-opts'), 'DESC' => __('Descending', 'mfn-opts'), ), 'default' => "DESC", ] ); $this->end_controls_section(); $this->start_controls_section( 'advanced_section', [ 'label' => __( 'Advanced', 'mfn-opts' ), ] ); $this->add_control( 'margin', [ 'label' => __( 'Margin', 'mfn-opts' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => array( 1 => __('Default', 'mfn-opts'), 0 => __('No margins', 'mfn-opts'), ), 'default' => 1, ] ); $this->end_controls_section(); } /** * Render widget output on the frontend */ protected function render() { $settings = $this->get_settings_for_display(); // print_r($settings); echo sc_blog_teaser( $settings ); } }