Ich verwende das ACF-Pro-Datum & Zeitauswahl, um das Feld "fixture_date" für den benutzerdefinierten Beitragstyp "Fixtures" zu füllen. Das Ausführen einer new wp_Query
gibt alle Beiträge zurück, aber ich kann sie nicht nach dem Datum & des benutzerdefinierten Felds sortieren.WordPress-Posts mit ACF-Datums- und Zeitauswahl sortieren
Das Datum & Zeit Picker ist so eingestellt, dass j F Y - g:i a
aus ACF Pro ausgegeben wird.
Mein Code so weit:
<table id="fixturestable">
<tbody>
<?php $args = array(
'post_type' => 'fixtures',
'posts_per_page' => -1,
'orderby' => 'meta_value',
'meta_key' => 'fixture_date',
'order' => 'ASC',
'meta_type' => 'DATETIME'
);
$fixturesloop = new WP_Query($args); if ($fixturesloop->have_posts()):?>
<?php while ($fixturesloop->have_posts()) : $fixturesloop->the_post();?>
<tr>
<td class=""><?php the_title(); ?></td>
<td class=""><?php echo(get_field('fixture_date'));?></td>
<td class=""><?php echo(get_field('competition'));?></td>
<td class=""><?php echo(get_field('venue'));?></td>
<td class=""><?php echo(get_field('result'));?></td>
<td class=""><?php echo(get_field('score'));?></td>
</tr>
<?php endwhile;?>
<?php endif;?>
</tbody>
</table>