Support

Home Forums Community Forum Is there any way I can add custom excerpt to event like wordpress posts ??

Is there any way I can add custom excerpt to event like wordpress posts ??

Posted: March 30, 2016 at 5:46 am


pk

March 30, 2016 at 5:46 am

If I want to add excerpt to my events what I should do ?

if not possible, Can I use get_the_excerpt() from wordpress core ??

I am using Event Espresso – 3.1.15.P Get Version 4.4.2 . and getting empty string if I will try to ver_deump(get_the_excerpt()); on my event list page.


pk

March 30, 2016 at 6:24 am

sorry, there is a problem with the var_dump(), I do not know, how to edit the question.


Josh

  • Support Staff

March 30, 2016 at 8:12 am

Hi there,

It turns out that in EE3, events are not custom post types. Along with that, they do not have excerpts. You can make a rough equivalent to a hand crafted excerpt by adding the more tag to your event description, then use some PHP in your template like this:

$event_desc = stripslashes_deep($event->event_desc);
$event_desc = explode('<!--more-->', $event_desc);
$event_desc = array_shift($event_desc);


pk

March 30, 2016 at 8:20 am

thank you so much for your reply . It is now more interesting for me how events are created if they are not custom post type ? if possible please answer.


Josh

  • Support Staff

March 30, 2016 at 2:19 pm

They are added to custom database tables instead of being added to the posts table.


pk

March 30, 2016 at 11:09 pm

yes, I got it by going through add_new_event.php file and before that I echo(json_encode($event_meta)) I got the idea, thank you for your time 🙂

The support post ‘Is there any way I can add custom excerpt to event like wordpress posts ??’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso