Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active October 18, 2016 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lorenzocaum/becd3ffbeb4c344ff444 to your computer and use it in GitHub Desktop.
Save lorenzocaum/becd3ffbeb4c344ff444 to your computer and use it in GitHub Desktop.
Add a previous event and next event link to the end of the single event pages in Event Espresso 4

This sample coding can be added to your child theme’s functions.php file (do not include the opening php tag) or a site specific plugin:

http://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

Here is a preview of what it will look like:

http://cl.ly/image/0s2q1q0a2u0u

Add the sample code below to your child theme's functions.php file or in a site specific plugin.

<?php
//* Do NOT include the opening php tag
 
//* Add a previous event and next event link to single event pages in Event Espresso 4
function ee_previous_event_next_event_navigation(){    
	if( is_singular() && is_espresso_event() ){
	?>
    <div class="ee-after-event-navigation"><div class="ee-after-event-navigation-previous" style="float:left"><?php previous_post_link('&laquo; %link', 'Previous Event: %title'); ?></div><div class="ee-after-event-navigation-next" style="float:right"><?php next_post_link('%link &raquo; ', 'Next Event: %title'); ?></div></div>
    <?php
    }
}
add_action( 'AHEE_event_details_footer_bottom', 'ee_previous_event_next_event_navigation' );
@joshfeck
Copy link

The above code does not work, please see this fork:

https://gist.github.com/joshfeck/dd973689274dd58ed34a05fc9fb8fa3e

See also this other gist that shows how to change the order of the next/previous event links so they sort by the event's primary date time:

https://gist.github.com/joshfeck/a8e28b9cfecd89308fbea4c152f546c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment