Search code examples
phpwordpresspluginswordpress-plugin-creation

Elementor Custom Widget - _content_template function hanging


I have a _content_template() function that looks like this

so the issue I'm facing is that if I call $this->get_settings_for_display(); inside of this function, elementor just loads and nothing happens it just stays on the loading sceen (see image at the bottom), I have the exact same code in render() and I have the same issue.

 protected function _content_template(){      
    $isInternational = false; // DEFAULT TO INTERNATIONAL
    $settings = $this->get_settings_for_display();
    
    // SOLO
    $solo_pricing_monthly = $isInternational ? $settings['label_us_pricing_solo_monthly'] : $settings['label_za_pricing_solo_monthly'];
    $solo_pricing_monthly_with_marketing = $isInternational ? $settings['label_us_pricing_solo_monthly_with_marketing'] : $settings['label_za_pricing_solo_monthly_with_marketing']; 
    $solo_pricing_yearly = $isInternational ? $settings['label_us_pricing_solo_yearly'] : $settings['label_za_pricing_solo_yearly'];
    $solo_pricing_yearly_with_marketing = $isInternational ? $settings['label_us_pricing_solo_yearly_with_marketing'] : $settings['label_za_pricing_solo_yearly_with_marketing']; 

    // LITE
    $lite_pricing_monthly = $isInternational ? $settings['label_us_pricing_lite_monthly'] : $settings['label_za_pricing_lite_monthly'];
    $lite_pricing_monthly_with_marketing = $isInternational ? $settings['label_us_pricing_lite_monthly_with_marketing'] : $settings['label_za_pricing_lite_monthly_with_marketing']; 
    $lite_pricing_yearly = $isInternational ? $settings['label_us_pricing_lite_yearly'] : $settings['label_za_pricing_lite_yearly'];
    $lite_pricing_yearly_with_marketing = $isInternational ? $settings['label_us_pricing_lite_yearly_with_marketing'] : $settings['label_za_pricing_lite_yearly_with_marketing']; 

    // BUSINESS LITE
    $business_lite_pricing_monthly = $isInternational ? $settings['label_us_pricing_business_lite_monthly'] : $settings['label_za_pricing_business_lite_monthly'];
    $business_lite_pricing_monthly_with_marketing = $isInternational ? $settings['label_us_pricing_business_lite_monthly_with_marketing'] : $settings['label_za_pricing_business_lite_monthly_with_marketing']; 
    $business_lite_pricing_yearly = $isInternational ? $settings['label_us_pricing_business_lite_yearly'] : $settings['label_za_pricing_business_lite_yearly'];
    $business_lite_pricing_yearly_with_marketing = $isInternational ? $settings['label_us_pricing_business_lite_yearly_with_marketing'] : $settings['label_za_pricing_business_lite_yearly_with_marketing']; 

    // BUSINESS PRO
    $business_pro_pricing_monthly = $isInternational ? $settings['label_us_pricing_business_pro_monthly'] : $settings['label_za_pricing_business_pro_monthly'];
    $business_pro_pricing_monthly_with_marketing = $isInternational ? $settings['label_us_pricing_business_pro_monthly_with_marketing'] : $settings['label_za_pricing_business_pro_monthly_with_marketing']; 
    $business_pro_pricing_yearly = $isInternational ? $settings['label_us_pricing_business_pro_yearly'] : $settings['label_za_pricing_business_pro_yearly'];
    $business_pro_pricing_yearly_with_marketing = $isInternational ? $settings['label_us_pricing_business_pro_yearly_with_marketing'] : $settings['label_za_pricing_business_pro_yearly_with_marketing']; 

    ?>
        <h2><?php echo $solo_pricing_monthly; ?></h2>
    <?php
 // more code here

enter image description here


Solution

  • _content_template() function got deprecated from the Elementor version 2.9.0

    protected function content_template(){  }
    

    Use the function without the _ (underscore) character and it will work perfectly.