Created
September 22, 2020 09:58
-
-
Save hrenaud/29bce95d4d28f792824c825de3022aea to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| add_action( | |
| /* Pre-Elementor 2.5.1 use this: | |
| 'elementor_pro/posts/query/lwp_related_posts', */ | |
| 'elementor/query/lwp_contributeurs_de_travaux', | |
| 'lwp_0001_contributeurs_de_travaux' | |
| ); | |
| function lwp_0001_contributeurs_de_travaux( $query ) { | |
| global $post; | |
| $contributeurs = get_field('contributeurs'); | |
| //displayValue($contributeurs); | |
| if($contributeurs != "") { | |
| //displayValue("OK"); | |
| $query->set( 'post_type', 'membres' ); | |
| $query->set( 'posts_per_page', -1 ); | |
| $query->set( 'post__in', $contributeurs); | |
| } else { | |
| //displayValue("KO!"); | |
| $query->set( 'post_type', 'membres' ); | |
| $query->set( 'posts_per_page', -1 ); | |
| $meta_query[] = [ | |
| 'key' => 'project_type', | |
| 'value' => [ 'design', 'development' ], | |
| 'compare' => 'in', | |
| ]; | |
| $query->set( 'meta_query', $meta_query ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment