• Resolved Redpik

    (@redpik)


    Hi,
    Can I remove a section by ID in PHP ? Maybe with before_render hook ?
    I want to remove it (or just the content), not to hide it.
    Thank you for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I found this in /includes/base/element-base.php starting at line 601, public function ‘print_element‘ appears to be the control mechanism of whether something renders.

    Within this function is a filter:

    $should_render = apply_filters( “elementor/frontend/{$element_type}/should_render”, $should_render, $this );

    So you might be able to check $type = $this->get_name() to confirm the element type is a ‘section‘ and then $settings = $this->get_settings() and check to ensure $settings[‘_element_id’] matches a custom section CSS id and then pass $should_render as false to keep THAT section from rendering based upon your custom PHP condition(s).

    I have not tested any of this. Best of luck an success to you.

    Working on this problem myself – https://github.com/elementor/elementor/issues/4246

    Only way I found to do my own conditional logic is to use Elementor Pro’s shortcode way of rendering sections and globals, then one can perform any back end logic choosing whether to return or echo out the do_shortcode(‘[elementor…]’) somewhere within the theme files.

    Thread Starter Redpik

    (@redpik)

    Thank you pingram, I will follow the tread on GitHub.
    Have a nice day.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP : remove a section’ is closed to new replies.