Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active February 6, 2017 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/4bfdcaad62671a65583bac52df8e32eb to your computer and use it in GitHub Desktop.
Save joshfeck/4bfdcaad62671a65583bac52df8e32eb to your computer and use it in GitHub Desktop.
Use a filter hook to change the length of the event excerpt displayed in the event listings.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__content_espresso_events_details_template__the_content', 'my_custom_ee_excerpt_length' );
function my_custom_ee_excerpt_length( $excerpt ) {
$excerpt = espresso_event_content_or_excerpt( 20, null, false );
return $excerpt;
}
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'FHEE__content_espresso_events_details_template__the_content', 'my_custom_ee_excerpt_length_and_text' );
function my_custom_ee_excerpt_length_and_text( $excerpt ) {
$more = ' <a href="' . get_permalink() . '"';
$more .= ' class="more-link"';
$more .= \EED_Events_Archive::link_target();
$more .= '>' . 'my more text' . '</a>'; // change text on this line of code
$excerpt = espresso_event_content_or_excerpt( 20, $more, false );
return $excerpt;
}

Usage notes

You can add the code to a functions plugin or into your WordPress theme's functions.php file.

You can change 20 to a different value to suit your needs (number of words).

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