Home › Forums › General Issues › Using ACF date to sort custom post types not sorting correctly › Reply To: Using ACF date to sort custom post types not sorting correctly
This is my field (sorry in Dutch):
This is the loop
<?php $args = array(
'post_type' => 'foto_archief',
'orderby' => 'meta_value_num',
'meta_key' => 'date',
'order' => 'ASC',
'posts_per_page' => -1
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<h3><?php the_title(); ?></h3>
<p><?php echo get_field('date'); ?></p>
<?php endwhile; endif; wp_reset_postdata(); ?>
And this is what the list looks like
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!
ACF Blocks works across the WordPress Full Site Editor and block themes! See how they can help you build faster without learning React. https://t.co/ViL7VURG1M
— Advanced Custom Fields (@wp_acf) May 9, 2022
© 2022 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.