admin管理员组文章数量:1279051
as the title says, I'm trying to hook into Elementor's exisiting CTA-widget and turn the existing input field into a WYSIWYG-field by looking at the widget's structure etc. within elementor pro directory. But somehow nothing happens. If I change it in the plugins source file it works, but sure I want to override it through my functions.php.
I've done this for the slides Widget before and that worked well. What am I missing here?
/*
* Set Elementor > CTA widget description as wysiwyg Text Editor
*/
add_action( 'elementor/element/call-to-action/section_content/before_section_end', function( $widget, $args ) {
$cta_control = \Elementor\Plugin::instance()->controls_manager->get_control_from_stack( $widget->get_unique_name(), 'call-to-action' );
if ( is_wp_error( $cta_control ) ) {
return;
}
$cta_control['fields']['description']['type'] = \Elementor\Controls_Manager::WYSIWYG;
$widget->update_control( 'call-to-action', $cta_control );
},10 ,2 );
Any help appreciated. Thank you.
as the title says, I'm trying to hook into Elementor's exisiting CTA-widget and turn the existing input field into a WYSIWYG-field by looking at the widget's structure etc. within elementor pro directory. But somehow nothing happens. If I change it in the plugins source file it works, but sure I want to override it through my functions.php.
I've done this for the slides Widget before and that worked well. What am I missing here?
/*
* Set Elementor > CTA widget description as wysiwyg Text Editor
*/
add_action( 'elementor/element/call-to-action/section_content/before_section_end', function( $widget, $args ) {
$cta_control = \Elementor\Plugin::instance()->controls_manager->get_control_from_stack( $widget->get_unique_name(), 'call-to-action' );
if ( is_wp_error( $cta_control ) ) {
return;
}
$cta_control['fields']['description']['type'] = \Elementor\Controls_Manager::WYSIWYG;
$widget->update_control( 'call-to-action', $cta_control );
},10 ,2 );
Any help appreciated. Thank you.
Share Improve this question asked Feb 25 at 8:13 BradleyBradley 1093 silver badges17 bronze badges1 Answer
Reset to default 1it looks your code is fine i change little bit try this
add_action( 'elementor/element/call-to-action/section_content/before_section_end', function( $widget ) {
$widget->update_control(
'description',
[
'type' => \Elementor\Controls_Manager::WYSIWYG,
]
);
}, 10, 1 );
版权声明:本文标题:php - Turn the description input field of Elementor's Call-To-Action Widget into a WYSIWYG-field - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741220256a2360836.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论