Last active
January 15, 2016 14:02
-
-
Save joshfeck/1c9ba7516f4a6278aa2b to your computer and use it in GitHub Desktop.
Custom archive template for the Espresso Events post type. This can be used in a Genesis child theme. Requires Event Espresso 4.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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