Can you help me also please, I’m having issue on creating a page that will list all events posted for all cats/venues.
I created a page called EVENTS and set the template that i called “Cycling Events” the template file I also created in theme directory events-template.php, below i’m posting what I have in that events-template.php file –
<?php
/**
* Template Name: Cycling Events
*
*/
get_header(); ?>
<!-- Event Code To Go Here
================================================== -->
<?php $args = array(
'post_type' => 'am_event',
'post_status' => 'published',
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
while ($the_query->have_posts()) {
$the_query->the_post();
$postId = $post->ID;
// GET EVENT DATA
$startDate = am_get_the_startdate('Y-m-d H:i:s');
$endDate = am_get_the_enddate('Y-m-d H:i:s');
$venues = am_get_the_venue( $postId );
$eventCategories = am_get_the_category( $postId );
// DISPLAY EVENT CONTENT
the_title();
echo '<p>' . $startDate . '</p>';
echo '<p>' . $endDate . '</p>';
// echo the first venue
echo '<p>' . $venues[0]->cat_name . '</p>';
// echo list of all event categories with template tag
am_the_event_category();
the_content();
}
}
?>
<!-- Sidebar
================================================== -->
<?php get_sidebar('home'); ?>
<!-- Container / End -->
<?php get_footer(); ?>
Thank you!