Custom widget, how to render template within editor via content_template #13347
Replies: 1 comment 1 reply
-
I found an answer, not at all what I expected. My solution was to delete that content_template function completely! Apparently, Elementor core will render my PHP code even when picking up changes made during editing. My guess is that it AJAX's back to my PHP render() function. But in that case, why does the documentation say "_content_template() lets you recreate the render() method in JavaScript to be used in the Editor" and "using it will render the content of the widget on any instantly on any change to one of his controls without making a request to the server."? I get the instant change I want without using _content_template. So I have the results I need, but still a mystery. 😃 |
Beta Was this translation helpful? Give feedback.
-
I am building my first custom widget. Its functionality includes allowing for an Elementor template in place of a text box or editor for some of the content. It is working fine on the front end. But I'm looking for a way to get the content_template function to render the embedded template as a preview within the editor.
I can reach and display the template ID. But what function would I use to render the template itself?
Beta Was this translation helpful? Give feedback.
All reactions