Posted: 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?? |
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. |
|
|
Josh, I want them to display but not twice. In my content-espresso_events.php page i have 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. |
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:
Then you remove that line of code. |
|
|
Josh, The default page loads a header image that is defined as a custom field of the post ($headerimage = get_option(‘headerimage’);) 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. |
|
Josh, An image of the display is here http://pho.to/A26A7 |
|
Josh, An image of the code for the content-espresso_events.php page |
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. |
|
|
Josh, Is this the files you were after? content-espresso_events – http://pastebin.com/Yzu8wGmR |
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()? |
|
|
Nothing in my theme adds or removes filters for the_content of the_excerpt. I tried deactivating all other plugins and no change. |
If that’s the case, if you change:
to
in the content-espresso_events-details.php file, that should fix things for you. |
|
|
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. |
Hi Allan, It’s not an issue with the $post object. |
|
|
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 |
|
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. |
Did you see my suggestion to change the function call inside that template? Along with that, you could also try removing those two do_actions there as well. |
|
|
Josh, I replaced the espresso_event_content_or_exerpt() function with the_content(); I still get a double up of text. |
This means something is triggering adding the extra elements via filters on the_content(). You could try replacing 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. |
|
|
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 |
|
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 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. |
|
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); |
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?
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. |
|
|
Tony, I have 4.8.20.p I have a screen grab of the list of files I have in the child theme. |
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? |
|
|
Tony, Thanks, I will give that a go and see how things develop. |
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 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) |
|
|
Tony, I removed the event espresso core and replace it with the latest version. 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 |
Is this a live site, ie can I view the page? The page you have this shortcode:
loading on, is that set to use your ‘Event Details’ template from above? (single-espresso_events.php) |
|
|
Tony, No the page is just using the default template. |
You can use the form here: |
|
|
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??? |
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. |
|
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.