Last active
July 11, 2016 10:55
-
-
Save apsolut/20a6008185dd3470110b7364a75a3248 to your computer and use it in GitHub Desktop.
Loop meta query and custom post type
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
<!-- custom post type and acf field + --> | |
<?php | |
$topdate = date('Y-m-d H:i:s'); | |
$main_match_arg = array( | |
'post_type' => 'matches', | |
'post_status' => 'publish', | |
'tax_query' => array( | |
'relation' => 'AND', | |
array( | |
'taxonomy' => 'decom_match_categories', | |
'field' => 'slug', | |
'terms' => array( 'haupspiele' ), | |
'include_children' => false, | |
'operator' => 'IN' | |
), | |
), | |
'posts_per_page' => 4, | |
'ignore_sticky_posts' => true, | |
'meta_query' => array( | |
array( | |
'key' => 'game_time_and_date_match_details', | |
'compare' => '>=', | |
'value' => $topdate, | |
), | |
), | |
'meta_key' => 'game_time_and_date_match_details', | |
'orderby' => 'meta_value', | |
'order' => 'ASC', | |
'suppress_filters' => false, | |
); ?> | |
<?php | |
$main_match_query = new WP_Query( $main_match_arg ); | |
if ( $main_match_query->have_posts() ) : ?> | |
<?php while ( $main_match_query->have_posts() ) : $main_match_query->the_post(); ?> | |
Hello our loop is here | |
<?php endwhile; ?> | |
<?php endif; wp_reset_postdata(); ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment