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__));;
}
}
- newest
- hottest
See only the author.