Elementor自定义小部件-_content_template功能挂起
我有一个_CONTENT_TEMPLATE()
函数看起来像
这样,Elementor只是加载而什么都没有发生,它只是停留在加载sceen上(请参见底部的图像),我在render()
中具有完全相同的代码,并且我遇到了相同的问题。
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
_CONTENT_TEMPLATE()
函数获得 def> defcated 2.9.0版本2.9.0使用无_(undersScore)字符的功能,它将完美地工作。
_content_template()
function got deprecated from the Elementor version 2.9.0Use the function without the _ (underscore) character and it will work perfectly.