We learned how to do a custom loop and output custom data from our custom post types and custom fields in the last video. This time we need to do it again, only for the slightly more complex Events section. We'll need a custom page template just for the events area so we have a place we can write all this custom code.
$the_query = new WP_Query(array( 'post_type' => 'events', // This is the name of our custom post type 'posts_per_page' => -1 // -1 means "all of them" ));
while ($the_query->have_posts()) : $the_query->the_post(); ?> // we're in the loop! endwhile;
And inside the loop, we can use the ACP API to output custom fields:
All that's left now is styling it up right and making sure we're outputting every last bit of data we want to display.