Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom archive template for the Espresso Events post type. This can be used in a Genesis child theme. Requires Event Espresso 4.
<?php
remove_action ( 'genesis_loop', 'genesis_do_loop' ); // Remove the standard loop
add_action( 'genesis_loop', 'custom_espresso_events_archive_loop' ); // Add custom loop
// Optional: Remove post info
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
function custom_espresso_events_archive_loop() {
if ( have_posts() ) :
// allow other stuff
do_action( 'AHEE__archive_espresso_events_template__before_loop' );
// Start the Loop.
while ( have_posts() ) : the_post();
// Include the post TYPE-specific template for the content.
espresso_get_template_part( 'content', 'espresso_events' );
endwhile;
// Previous/next page navigation.
do_action( 'genesis_after_endwhile' );
// allow moar other stuff
do_action( 'AHEE__archive_espresso_events_template__after_loop' );
else :
// If no content, include the "No posts found" template.
espresso_get_template_part( 'content', 'none' );
endif;
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment