Support

Home Forums Event Espresso Premium Event Description showing date, description and ticket button in listing

Event Description showing date, description and ticket button in listing

Posted: February 17, 2016 at 2:32 pm

Viewing 32 reply threads


Allan Browning

February 17, 2016 at 2:32 pm

Hi,

I have added a shortcode ([ESPRESSO_EVENTS category_slug=”kids” ]) for an event category to a standard page. The event description is returning the date description and ticket info. How can I get it to display just the description. If I add and event category item to the menu the listing is fine. Its just when I add a shortcode to page. Any ideas??


Josh

  • Support Staff

February 17, 2016 at 4:45 pm

Hi Allan,

Normally the display of the date and ticket selector is controlled by going to Event Espresso > Events > Templates tab. You can go there and then under where it says Event List Pages, you set Display Ticket Selector and Display Datetimes to No.


Allan Browning

February 17, 2016 at 5:13 pm

Josh,

I want them to display but not twice. In my content-espresso_events.php page i have
<?php espresso_get_template_part( ‘content’, ‘espresso_events-header’ ); ?>
<?php espresso_get_template_part( ‘content’, ‘espresso_events-datetimes’ ); ?>
<?php espresso_get_template_part( ‘content’, ‘espresso_events-details’ ); ?>
<?php espresso_get_template_part( ‘content’, ‘espresso_events-tickets’ ); ?>

The espresso_event-details section is displaying the date, description and ticket button. I only want it to display the description.

Just to confirm the shortcodes uses these files to display the event listing.

I have a default page in which I have included the shortcode to display a list of events from that category.

What I currently see is the title, the date, a Read More button then the description then the date again then the read more button again. If I remove all but the description section I get the date, description and a read more button. I only want the description.


Josh

  • Support Staff

February 17, 2016 at 5:31 pm

Hi Allan,

Twice? Did you mention that before?

It might help to know a bit more of the context of the changes you’ve made to the templates (Why and How?), if you’ve made changes that is. This is a wild guess, but if you have a current copy of content-espresso_events.php and it has the following:

add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_true' );

Then you remove that line of code.


Allan Browning

February 17, 2016 at 6:32 pm

Josh,

The default page loads a header image that is defined as a custom field of the post ($headerimage = get_option(‘headerimage’);)
and then the shortcode should display the list of events from a set category.

The content-espresso_events.php is essential that same with some extra div tags added for my layout and styling. The filter you mentioned was not in the file.


Allan Browning

February 17, 2016 at 6:37 pm

Josh,

An image of the display is here http://pho.to/A26A7


Allan Browning

February 17, 2016 at 6:43 pm

Josh,

An image of the code for the content-espresso_events.php page

http://pho.to/A26B2


Josh

  • Support Staff

February 17, 2016 at 7:31 pm

Hi Allan,

It will be really helpful if you can post the contents of the custom templates into a pastebin or a github gist. Especially if there’s more than the content-espresso_events. For example, do you have a custom single-espresso_events.php template too? If you do, please post the code to a pastebin or gist and link to them here.


Allan Browning

February 17, 2016 at 8:17 pm

Josh,

Is this the files you were after?

content-espresso_events – http://pastebin.com/Yzu8wGmR
single-espresso_events.php – http://pastebin.com/q0QE3qb0
content-espresso_events-details.php – http://pastebin.com/tQAggedh


Josh

  • Support Staff

February 18, 2016 at 1:17 pm

Hi Allan,

No it turns out those do not reveal much. Do you have any functions in your theme that add or remove filters from the_content() or the_excerpt()?


Allan Browning

February 18, 2016 at 3:18 pm

Nothing in my theme adds or removes filters for the_content of the_excerpt. I tried deactivating all other plugins and no change.


Josh

  • Support Staff

February 18, 2016 at 3:34 pm

If that’s the case, if you change:

espresso_event_content_or_excerpt(55,"&nbsp;");

to

the_content();

in the content-espresso_events-details.php file, that should fix things for you.


Allan Browning

February 18, 2016 at 3:38 pm

I have made a small edit to EEH_Event_View.helper.php at around line 151 in the function event_content_or_excerpt. I commented out the_content and did a print_r on $post to see if it showed up anything. Not sure if this will help in the diagnosis.

http://pastebin.com/HS7zHBQ5


Josh

  • Support Staff

February 18, 2016 at 3:41 pm

Hi Allan,

It’s not an issue with the $post object.


Allan Browning

February 18, 2016 at 3:48 pm

Josh,

I have also tried uncommenting a line at 150 in EEH_Event_view.helper.php. I assume this is some code you use to tell which of the if statements is being triggered. It shows it being done twice.

Source code http://pastebin.com/B5TcUu6p


Allan Browning

February 18, 2016 at 3:55 pm

I did another test this time uncommenting line 2 in content-espresso_events-details.php. It seems that line w get echo’d and the <div class=”inov8-event-desc”> tag is written then it starts doing the file again.

http://pastebin.com/b0KeH5mG


Josh

  • Support Staff

February 18, 2016 at 5:17 pm

Did you see my suggestion to change the function call inside that template?
https://eventespresso.com/topic/event-description-showing-date-description-and-ticket-button-in-listing/#post-193119

Along with that, you could also try removing those two do_actions there as well.


Allan Browning

February 18, 2016 at 5:37 pm

Josh,

I replaced the espresso_event_content_or_exerpt() function with the_content(); I still get a double up of text.
I have also removed the do actions with no effect.


Josh

  • Support Staff

February 18, 2016 at 6:29 pm

This means something is triggering adding the extra elements via filters on the_content().

You could try replacing the_content(); with
echo get_the_content();

get_the_content() will not have any of the filters on the_content, which will fix the issue you’re seeing with the extra elements. There’s a downside to this though, because none of the filters that normally get applied to the_content get applied to get_the_content(). So if you use shortcodes or need to apply some formatting to the event description, using get_the_content() isn’t going to be a long-term solution.


Allan Browning

February 18, 2016 at 8:18 pm

Josh,

The order in which the second set of information is ordered is the same as the display order in the templates section.Use Custom Display Order is set to NO.

Photo of settings page http://pho.to/A2Bdt


Allan Browning

February 18, 2016 at 8:40 pm

I was searching through my whole site to find mentions of add_filter(‘the_content)

I found the following in EED_Events_Archive-module.php

http://pastebin.com/VZzLiu9m

The filter for the_content is first removed then added back in. If I comment out the add_filter at line 245 the page works properly without the duplicates.


Allan Browning

February 18, 2016 at 8:53 pm

Josh,

Can I suggest an option for a future release that allows you to turn off (not display) the “more…” link in the content of an event item in a listing. There is the read more or View Details button available that does the same thing. The only way I found to do it was modify line 152 in EEH_Event_View.helper.php from the_content(); to the_content(”,true);


Tony

  • Support Staff

February 19, 2016 at 4:13 am

Hi Allan,

Which version number of EE4 are you using? Those line number don’t match up with the latest version.

Do you have other EE template files loading from within your theme? If so which files do you have?

The filter for the_content is first removed then added back in. If I comment out the add_filter at line 245 the page works properly without the duplicates.

That works because your removing the filter that adds the details, its not the root cause of the problem. Something is calling the_content more than once and so the details added by that filter are added more than once.


Allan Browning

February 19, 2016 at 4:21 am

Tony,

I have 4.8.20.p

I have a screen grab of the list of files I have in the child theme.

http://pho.to/A2Cyk


Tony

  • Support Staff

February 19, 2016 at 4:35 am

Can you create a full site backup and update to the latest version please.

loop-espresso_events.php should not be loaded within your theme, can you first rename that file, use something like loop-espresso_events2.php just to prevent it from loading.

Do you need full control over all of the templates?

The reason I ask is with the latest version of Event Espresso it is possible to use the custom ordering within the Event Espresso settings AND load custom templates at the same time. If all you are doing is changing the order the order of the details you could do that with EE now but I can see you also add some additional divs for styling, is that to all templates?

Basically you can use EE to set a custom template order and then tell EE to load your custom templates from within your theme. The difference being that EE controls when and how everything it loaded, you just style your templates to suit how you want.

I think that would work better if you want to try that?


Allan Browning

February 19, 2016 at 5:02 am

Tony,

Thanks, I will give that a go and see how things develop.
Thanks for you yours and Josh’s Help


Tony

  • Support Staff

February 19, 2016 at 5:20 am

What I would recommend doing is creating a copy of your child theme, rename the copy to iag_child_original or something.

That way you can always revert back to that version of the child theme if anything goes wrong.

Then start by moving all of the EE templates into their own directory (which will stop them loading) then checking how EE loads.

Then all you’ll need to do is move the template files you’ve added code to into the root fold again (I’d do this one by one and test between, to confirm they do what is expected)

These templates would NOT be the templates that load other templates, like content-espresso_events.php but the individual templates, like:

content-espresso_events-details.php
content-espresso_events-datetimes.php

Etc.

What will happen is EE will check your themes root directory for a copy of those individual templates and then use that modified template within the new custom order feature. So you get the best of both.

Controlling the templates from beginning to end means you need to do all of this manually.

One gotcha you may run into is with single-espresso_events.php and archive-espresso_events.php, Event Espresso checks if those templates are being used and disables the custom ordering, why? Because it assumes your taking over full control of the templates again.

We can prevent that from happening but start by getting your custom templates to load with the custom ordering (don’t use the single-espresso_events.php or archive-espresso_events.php template files within root)


Allan Browning

February 20, 2016 at 12:27 am

Tony,

I removed the event espresso core and replace it with the latest version.
I tried removing all of the EE files from the child theme but was not able to change the order of the display. The ticket selector was alway on top.

I then put all of the files back and now only the first entry in the list has the double up of the information in the description details.

Screen grab of listing page – http://pho.to/A2Gq6


Tony

  • Support Staff

February 22, 2016 at 2:42 am

Is this a live site, ie can I view the page?

The page you have this shortcode:

[ESPRESSO_EVENTS category_slug=”kids”]

loading on, is that set to use your ‘Event Details’ template from above? (single-espresso_events.php)


Allan Browning

February 22, 2016 at 3:33 am

Tony,

No the page is just using the default template.
Where can I send you details for the server off forum


Tony

  • Support Staff

February 22, 2016 at 3:42 am

You can use the form here:

https://eventespresso.com/send-login-details/


Allan Browning

February 22, 2016 at 4:01 pm

Not sure If I have found a solution.

I did some testing with the below code:

echo ‘

';
var_dump( $wp_filter['the_content'] );
echo '

‘;

I added this code into the event_content_or_excerpt function in EEH_Event_View.helper.php at around line 151. (In the section the prints out the_content().) I found that for the first item in the list a filter for event_details was being applied to the_content(). This filter was not being applied on any of the subsequent items in the list. I removed the filter using remove_filter(‘the_content’,array(‘EED_Events_Archive’, ‘event_details’),100); on the line before the call to the_content().All seems to be working fine now.

Your Thoughts???


Josh

  • Support Staff

February 22, 2016 at 6:16 pm

Normally that should not be necessarily. When you remove that filter, you’re removing a symptom, not the root cause of why those are being output twice.

Viewing 32 reply threads

The support post ‘Event Description showing date, description and ticket button in listing’ 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