How to display Elementor widget from another Elementor widget using PHP
Question
I create a custom Elementor widget like plugin and want to use another Elementor widget from it. It is not a problem to show a standard WordPress widget (code in the function render()
):
the_widget('WP_Widget_Calendar');
It is not a problem to show a post with Elementor widgets:
$plugin = ElementorPlugin::instance();
echo $plugin->frontend->get_builder_content_for_display($any_post_id);
Also I see with this code
global $wp_widget_factory;
echo '<pre>'; var_dump($wp_widget_factory->widgets); echo '</pre>';
all registered widgets:
"WP_Widget_Pages"
"WP_Widget_Calendar"
"WP_Widget_Archives"
"WP_Widget_Media_Audio"
"WP_Widget_Media_Image"
"WP_Widget_Media_Gallery"
"WP_Widget_Media_Video"
"WP_Widget_Meta"
"WP_Widget_Search"
"WP_Widget_Text"
"WP_Widget_Categories"
"WP_Widget_Recent_Posts"
"WP_Widget_Recent_Comments"
"WP_Widget_RSS"
"WP_Widget_Tag_Cloud"
"WP_Nav_Menu_Widget"
"WP_Widget_Custom_HTML"
"MSP_Main_Widget"
"RevSliderWidget"
"WpfWoofiltersWidget"
"wp_ulike_widget"
"WC_Widget_Cart"
"WC_Widget_Layered_Nav_Filters"
"WC_Widget_Product_Categories"
"WC_Widget_Product_Search"
"WC_Widget_Product_Tag_Cloud"
"WC_Widget_Products"
"WC_Widget_Recently_Viewed"
"WC_Widget_Top_Rated_Products"
"WC_Widget_Rating_Filter"
"MC4WP_Form_Widget"
"Element_Pack_Elementor_Template_Widget"
"aux_about_widget"
"aux_recent_post_widget"
"aux_popular_posts_widget"
"aux_testimonial"
"aux_staff"
"aux_audio"
"aux_code"
"aux_contact_form"
"aux_divider"
"aux_gmaps"
"aux_image"
"aux_before_after"
"aux_accordion_widget"
"aux_tabs_widget"
"aux_recent_product"
"aux_latest_posts_slider"
"aux_quote"
"aux_search"
"aux_socials_list"
"aux_video"
"aux_contact_box"
"aux_advance_recent_product"
"aux_latest_vendors"
"ElementorProModulesLibraryWP_WidgetsElementor_Library"
"AUXSHP_WC_Widget_Price_Filter"
"AUXSHP_WC_Widget_Recent_Reviews"
"AUXSHP_WC_Widget_Layered_Nav"
But how to show another data driven Elementor widget from the PHP-code in render()
?
My attempt to do this with this code did not work:
$data = self::build_data(...);
$element = new ElementorProModulesCarouselWidgetsMedia_Carousel($data);
$element->print_element();
Thank you for your guidance.
0
2 months
0 Answers
17 views
0
Leave an answer
You must login or register to add a new answer .