Events list display: truncated content
-
Hi, I followed the procedure described in this thread: https://wordpress.org/support/topic/events-list-display-truncated-content/ , Namely: I customized this file: /the-events-calendar/src/views/v2/list/event/description.php, changing line 24 as instructed so that the full post-content displays. Then I placed a copy of the file here: [my-child-theme]/tribe/events/v2/list/event/
However, as you can see on this website : brigitte-coppin.fr/agenda/ the truncated excerpt is still displayed (the text is cut and there is “…” where the text is truncated) …. could you please help with this issue?
The page I need help with: [log in to see the link]
-
Hi @benmez,
Thanks for reaching out to us with your question! If I understand correctly, you want to display the full text of your events in list view, and you’ve already created a template override for this purpose.
To achieve this, you can add the following snippet to your functions.php file:
function custom_excerpt_length( $length ) { return 100; // Set the excerpt length to 100 words } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
This will increase the word limit for event excerpts in list view, so the full text of your events will be displayed. If you prefer to show only a certain number of words, you can modify the value returned by thecustom_excerpt_length
function.I hope this helps! If you have any further questions or concerns, please let us know.
Kind regards,
JeanThanks Jean , I apologize for the long stretch of time before I customised the functions.php file. But I did and it worked!! The whole text is now displayed 🙂
However, in the list of event, the post content doesn’t respect the line break, as shown here : https://brigitte-coppin.fr/agenda/ (FYI, at the moment there is only event left in the list of event ).
Would it be possible to get the display of the post-content, as it is created? It displays correctly when you click on the title of the event, as shown here : https://brigitte-coppin.fr/agenda/promenade-historique-a-albi-81/. Could we get the same display in the list of events?
Thanks in advance for following up with this issue
Hi @benmez
From your /the-events-calendar/src/views/v2/list/event/description.php replace
echo (string) $event->excerpt;
with
echo get_the_content(null, false, $event->ID);
and see if that helps.
Thanks Darian, I did the procedure and put the customised description.php file in the right folder and nothing happened, there is no line break….
Hi @benmez
I just checked your event page, and it seems there’s also no line break on your event description. Could you try adding a line break and see if that makes a difference?
sorry, at the moment the author has shortened the text of her events to solve the truncation issue…
Since it is the end of the school year there are no more events planned but if you go to this page https://brigitte-coppin.fr/agenda/categorie/rencontres/ there is a list of past events. I created a line break in the event named ‘Collège de Saint-Gildas-des-Bois’, you can see that there is no line break, however, when you click on the event ‘College de Saint -Gildas des bois’ the line break is there….
I hope I am clear enough. thanks for following up
Hi @benmez
Could you try replacing the snippet with this one, and see if it helps?
echo wpautop(get_the_content(null, false, $event->ID));
Let me know how it goes.
Thks Darian but unfortunately it didn’t help….
Hi @benmez
Upon checking again, it seems a different template is used for the past events shown on the calendar where there are no upcoming events.
Could you try applying the same code and override this template
the-events-calendar/src/views/v2/latest-past/event/description.php
by creating
[child-theme]/tribe/events/v2/latest-past/event/description.php
, and see if that makes a difference.—
As for the latest snippet I provided, it seems it’s working when you view it here and check this event
École et collège de Cazères (31)
Let me know how it goes.
Hi Darian, I tried to overwrite the description.php template as instructed above but the linebreak doesn’t seem to appear on the upcoming event “rentree septembre 2023” as shown here: https://brigitte-coppin.fr/agenda/
also, with regards to your remark on the previous snippet and the past event “école et collège de Cazères” , I did the change in the description.php file at the time you advised and couldn’t see any effect… I had always assumed that the changes we do in the ftp are effective instantly…. maybe there were caches that weren’t emptied and prevented me from seeing the result of the change made that day…. I am not so sure about how to understand that delay…..
Hi @benmez
Just to confirm, is the issue now resolved on your end?
As for the delay, yes you could be right, it could be related to cache.
You can read more about it on our knowledgebase article: Caching Basics
Hi @benmez
Could you please confirm if you applied this code
echo wpautop(get_the_content(null, false, $event->ID));
on the following template override?- [your-theme]/tribe/events/v2/list/event/description.php
- [your-theme]/tribe/events/v2/latest-past/event/description.php
If so, please try using the code below and see if that makes a difference.
echo wpautop(get_the_content("more", false, $event->ID));
Let me know how it goes.
Hello Darian,
I need to apologize for keeping you busy, I did check that I had the description.php file with the correct snipett in both [your-theme]/tribe/events/v2/list/event/description.php & [your-theme]/tribe/events/v2/latest-past/event/description.php
As it didn’t work, I tried the snipett you suggested las , with “more” instead of ‘null’ , but I couldn’t see a change as you can see here : https://brigitte-coppin.fr/agenda/
HOWEVER I tried to redo the procedure in a test environment and when I went through the first step: adding the initial snipett (echo wpautop(get_the_content(null, false, $event->ID));) in the initial spot ([your-theme]/tribe/events/v2/list/event/description.php) I got the line break correct, as you can see here https://mezlef.net/agenda/
I apologize for taking up so much of your time when, obviously, there is something wrong with the brigitte-coppin.fr website that prevent the snippet from working correctly ( I will look it up on my end ). I am very grateful for your support and I thank you very much for following up with this issue. I apologise again for the inconvenience.
- The topic ‘Events list display: truncated content’ is closed to new replies.