Reputation: 49
I have a custom event-pod with these variables: url, date, time
So far this code is working:
<?php
$args = array(
'orderby' => 'date',
'post_type' => 'event',
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div><?php the_field('title');?></div>
<?php endwhile; else: ?> <p>Sorry. Calendar not up-to-date.</p> <?php endif; ?>
Echoing the title of each event is working, but how do I get the other variables ("date, time and url")?
Upvotes: 1
Views: 433
Reputation: 49
I solved it this way:
<?php
$args = array(
'orderby' => 'datum',
'post_type' => 'event',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'datum',
)
)
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
global $post;
$tours = pods('event', $post->ID);
$datum = $tours->display('datum');
$time = $tours->display('time');
$url = $tours->display('url');
[... show some div and print some variables...]
endwhile; else: ?> <p>Sorry. Calender not up-to-date.</p> <?php endif; ?>
Upvotes: 0