Skip to content

CHOOSE control on Page Settings - Would like to reloadPreview on change. #1556

@ryanlabelle

Description

@ryanlabelle

I've added a custom CHOOSE control for a sidebar on the page settings panel, I'd love to know if I can reloadPreview() on change just like the Templates Select you have added. Any suggestions?

https://cl.ly/002O3T2Q393y

Basically when I select your template select list, the preview reloads to show the new template, I would like to fire the same event when I choose different sidebar options.

Here is my code:

add_action( 'elementor/element/page-settings/section_page_settings/before_section_end', function( $element, $args ) {

    $element->add_control(
        'th_page_layout',
        [
            'label' => __( 'Sidebar', 'your-plugin' ),
            'type' => \Elementor\Controls_Manager::CHOOSE,
            'default' => 'full',
            'options' => [
                'left'    => [
                    'title' => __( 'Left', 'your-plugin' ),
                    'icon' => 'fa fa-long-arrow-left',
                ],
                'full' => [
                    'title' => __( 'No Sidebar', 'your-plugin' ),
                    'icon' => 'fa fa-times',
                ],
                'right' => [
                    'title' => __( 'Right', 'your-plugin' ),
                    'icon' => 'fa fa-long-arrow-right',
                ],

            ],
            'return_value' => 'yes',
        ]
    );
}, 10, 2 );

Thank you so much of your help. We are big fans of this builder and we hope to release a new theme that will help promote it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions