如何在 Elementor 自定义模块中渲染一个现有的模板-综合讨论论坛-讨论专区-光子波动网 | 专业WordPress修复服务,全球范围,快速响应
4
share (joys, benefits, privileges etc) with others

How to render an existing template in an Elementor custom module

I am creating an Elementor custom module with repeaters and I would like to be able to select an existing template for each repeater item and render it. How can I implement template selection in the Elementor control and render the appropriate template based on the selection on the frontend?

start_controls_section(
            'section_content', [
            [
                'label' => esc_html__('Content', 'textdomain'), [
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        ).

        $this->add_control(
            'store_settings',
            [
                'label' => esc_html__('Store Settings', 'textdomain'),
                'type' => \Elementor\Controls_Manager::REPEATER,
                'fields' => [
                    [
                        'name' => 'title_section', 'label' => __(()
                        'label' => __('Title for Section', 'custom-store'), \Elementor\Controls_Manager::REPEATER
                        
                        
                        'default' => __('Default Title', 'custom-store'), .
                    ]
                ]
            ]
        ).

        $this->end_controls_section();
    }

    protected function render()
    {
        $settings = $this->get_settings();
        $args = [];

        show_template('template', $args, str_replace(get_stylesheet_directory() . DIRECTORY_SEPARATOR, '', __DIR__));;
    }
}

 

20241213165239265-image

 


Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
commentaries Total 1

Please log in to post a comment

客服

first aid

online time
9:00 - 18:00

Contact Customer Service

扫一扫联系客服
telephone call 020-2206-9892
QQ contact 1025174874
Customer service mailbox info@361sale.com