Support » Plugin: The Events Calendar » Event excerpt in list view

  • In the events list view the content of the event is cutting arbitrarily, desconsidering de tag more.

    1. I have the following situation:
    • all events are not using the tag more to define the excerpt and are being displayed in the list view with more than 500 characters.
    • then I added the tag more in only one event, making this excerpt 88 charactes long.
    • but this event is still showing as all the others, with more than 500 characters.
    • I made a copy of the file \the-events-calendar\src\views\list\single-event.php in my theme:
    • found this: echo tribe_events_get_the_excerpt( null, wp_kses_allowed_html( 'post' ) );
    • tried to change to something like tribe_events_get_the_content, but this function doesn’t exists

    What I need to change to make the list view respect the excerpt lenght defined by the tag more?

    Or, at least, change the lenght applied to all?

    I need a solution to apply to the child theme, no to the core plugin.

    Any help will be appreciated.

    https://wordpress.org/plugins/the-events-calendar/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey there!

    Excerpts can be quite tricky. We’ve had some trouble with them before and detailed some of that work here:

    https://theeventscalendar.com/the-trouble-with-excerpts/

    Does using the manual except field in the post editor make a difference?

    Geoff

    Hi, geoffgraham.

    My problem isn’t really with HTML stripping in excerpts but with the lenght and with the fact that the plugin doesn’t respect the more tag…

    Manual excertp field is a bad solution for this site in particular, but I will consider in other uses.

    Regarding my current problem: is there a way to respect the more tag (I don’t mind the HTML stripping) or is there a way to change the default lenght without changing the core plugin?

    Plugin Author Andras Guseo

    (@aguseo)

    Hi Ifreitas,

    You will need to do a bit of customization for that.
    I reco to read these 2 articles first:
    https://theeventscalendar.com/knowledgebase/themers-guide/
    https://theeventscalendar.com/knowledgebase/template-overview/

    Then you will most probably need to do an override for this file:
    wp-content\plugins\the-events-calendar\src\views\list\single-event.php

    At the end of that you have:
    <?php echo tribe_events_get_the_excerpt( null, wp_kses_allowed_html( 'post' ) ); ?>

    You will need to cut that shorter with a php function.

    Hope this helps!

    Cheers,
    Andras

    Hi, aguseo.

    Thanks for the reply, but this was exactly my starting point for this thread…

    I need a guidance to change this function. I’ve already made a copy of the file in my theme, in order to change the size of the image in list view, but I couldn’t find what I need to do with this:

    <?php echo tribe_events_get_the_excerpt( null, wp_kses_allowed_html( 'post' ) ); ?>

    I know you guys have limited support in the free forum, but if anyone else knows how to do it, I appreciate.

    Plus one for this issue! Would really appreciate any help! 🙂

    P.S. Thanks for all the work you do for the community Aguseo!

    Found a hacky solution…

    Go to plugins/the-events-calendar/src/functions/template-tags/general.php

    Find the line

    return apply_filters( 'tribe_events_get_the_excerpt', $excerpt, $post );

    Then change it to this…

    if( strlen($excerpt) < 251) {
      $edited_excerpt = substr($excerpt, 0, 251);
    } else {
      $edited_excerpt = substr($excerpt, 0, 251) . '...';
    }
    
    return apply_filters( 'tribe_events_get_the_excerpt', $edited_excerpt, $post );

    Thanks for sharing the solution, Thomas!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Event excerpt in list view’ is closed to new replies.