Last active
March 18, 2024 22:57
-
-
Save MarieComet/7ff001750a5e8a0ec6a724fcb4c6ccdd to your computer and use it in GitHub Desktop.
Allow to select multiple post types as query source in Elementor Posts widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function elementor_posts_widget_multiple_post_types( $element, $args ) { | |
$element->update_control( | |
'posts_post_type', // control ID | |
[ | |
'type' => Elementor\Controls_Manager::SELECT2, | |
'multiple' => true, | |
] | |
); | |
} | |
add_action( 'elementor/element/posts/section_query/after_section_end', 'elementor_posts_widget_multiple_post_types', 10, 2 ); |
@TroopekYT yes, you don't need to create a new theme.
Thanks a lot it worked!
any chance you could reqrite this for the new loop grid?
Hi @nodex4.
What is the new loop grid please ?
Any doc ?
@MarieComet - I assume Nodex means this: https://elementor.com/help/loop-grid/
This would be very helpful for me too.
Exactly, i mean that one right there.
+1 for extending this to the loop grid builder, would be super helpful!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is it enough if i addd this to my theme's function.php file or should I make a new one?