0

I'm injecting a custom control section to the container widget including a Custom field. Now, I want to get the value from this field, modify it, and then output it along with the child heading widget.

function inject_heading_controls( $element, $args ) {

    $element->start_controls_section(
        'custom_field_group',
        [
            'tab' => \Elementor\Controls_Manager::TAB_LAYOUT,
            'label' => esc_html__( 'Custom Field Group', WDAEA_TEXTDOMAIN ),
        ]
    );

    $element->add_control(
        'custom_field',
        [
            'type' => \Elementor\Controls_Manager::TEXT,
            'label' => esc_html__( 'Custom Field', WDAEA_TEXTDOMAIN ),
        ]
    );

    $element->end_controls_section();

}
add_action( 'elementor/element/container/section_layout_container/before_section_start', 'inject_heading_controls', 10, 2 );

Custom Field Value: "We have" & Heading Widget text: "Real estate projects."

I want to concatenate 15 with the value from the field.

Here my expected outcome for the heading widget is: We have 15 Real estate projects.

0

Browse other questions tagged or ask your own question.