Home › Forums › Add-ons › Repeater Field › Query repeater sub-field date › Reply To: Query repeater sub-field date
I found the answer, if it can help !
<?php
date_default_timezone_set('Europe/Paris');
$date_1 = date('Ymd', strtotime("now"));
$date_2 = date('Ymd', strtotime("+12 months"));
?>
<?php
function my_posts_where( $where ) {
$where = str_replace("meta_key = 'evenement_%", "meta_key LIKE 'evenement_%", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
?>
<?php
$upcoming_args = array(
'category_name' => '2017',
'post_type' => 'spectacles',
'posts_per_page' => 100,
'meta_key' => 'evenement_%_date_fin_evenement',
'meta_compare' => 'between',
'meta_type' => 'numeric',
'meta_value' => array($date_1, $date_2),
'orderby' => 'meta_value_num',
'order' => 'ASC');
?>
<?php $upcoming_query = new WP_Query( $upcoming_args ); ?>
<?php if ( $upcoming_query->have_posts() ) : ?>
<?php while ( $upcoming_query->have_posts() ) : $upcoming_query->the_post(); ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.