Support

Home Forums Event Espresso Premium EE4 – Change Single event Display settings

EE4 – Change Single event Display settings

Posted: March 12, 2017 at 12:45 pm

Viewing 5 reply threads


gpahu

March 12, 2017 at 12:45 pm

good afternoon all,
I am using a child theme of Iced Mocha and I want to change the layout of my events.
So I recreated the single-espresso_events.php page in my child theme and updated the loop as follows:
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
espresso_get_template_part( ‘content/espresso/content’, ‘espresso_events’ );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;
?>
I then recreated a content-espresso_events.php in my child theme under content\espresso folders. This not only has the order I want but also the html tags etc. for formatting
Heres the important bit:
<div id=”espresso-event-header-dv-<?php echo $post->ID;?>” class=”espresso-event-header-dv”>
<?php espresso_get_template_part( ‘content/espresso/content’, ‘espresso_events-thumbnail’ ); ?>
<?php espresso_get_template_part( ‘content/espresso/content’, ‘espresso_events-header’ ); ?>
</div>

<div class=”espresso-event-wrapper-dv”>
<?php espresso_get_template_part( ‘content/espresso/content’, ‘espresso_events-datetimes’ ); ?>
<?php espresso_get_template_part( ‘content/espresso/content’, ‘espresso_events-venues’ ); ?>
<?php espresso_get_template_part( ‘content/espresso/content’, ‘espresso_events-details’ ); ?>
<?php espresso_get_template_part( ‘content/espresso/content’, ‘espresso_events-tickets’ ); ?>
<!– we’re here in single content-espresso_events –>
<footer class=”event-meta”>
<?php do_action( ‘AHEE_event_details_footer_top’, $post ); ?>
<?php do_action( ‘AHEE_event_details_footer_bottom’, $post ); ?>
</footer>
</div>
I recreated the php files within my child theme with formatting i wish.
So where I am having the issue is within the content-espresso_events-details.php file, namely
<?php
do_action( ‘AHEE_event_details_before_the_content’, $post );
espresso_event_content_or_excerpt();
do_action( ‘AHEE_event_details_after_the_content’, $post );
?>
when i use espresso_event_content_or_excerpt(); I get the venue, ticket, date/time repeated along with the description of the event which doubles the details on the page.

So my question is how do I display the Event contents (Description ) in the content-espresso_events.php file ?

BTW – I double checked the Event Espresso and the Use Custom Display Order is turned off

Thanks in advance for any help you can give.
Steph


Tony

  • Support Staff

March 13, 2017 at 8:26 am

Hi Steph,

Within \iced-mocha\includes\espresso-template-functions.php

You will find these 2 functions:

//Use the custom template order when using single-espresso_events.php template file.
add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_true' );

//Use the custom template order when using archive-espresso_events.php template file.
add_filter( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', '__return_true' );

What they do is tell Event Espresso to continue to inject the event details into the_content() even if you are using a custom single-espresso_events.php (or archive-espresso_events.php) file (which then allows you to use the custom ordering within EE).

So you need to disable the above , you can add:

add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_false' );

To you child themes functions.php which should disable that feature and allow you to call espresso_event_content_or_excerpt(); without all of the additional details.


gpahu

March 13, 2017 at 2:21 pm

thanks for the info Tony. That doesnt seem to work.
heres what i added to functions.php
//Use the custom template order when using single-espresso_events.php template file.
add_filter(‘FHEE__EED_Event_Single__template_include__allow_custom_selected_template’, ‘__return_false’ );
//Use the custom template order when using archive-espresso_events.php template file.
add_filter(‘FHEE__EED_Event_Archive__template_include__allow_custom_selected_template’, ‘__return_false’ );

What am I missing ?

Thanks for your help, Steph


Josh

  • Support Staff

March 13, 2017 at 5:32 pm

Hi Steph,

Your code is probably firing too early to make a difference. You can specify a priority to make sure your code gets applied to the filter, and remove the other filters first with something like this:

remove_all_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template');

add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_false', 11 );


gpahu

March 14, 2017 at 10:21 am

Bingo, Josh – that did the trick.
Thanks a million.
Steph


Tony

  • Support Staff

March 14, 2017 at 4:38 pm

My apologies Steph, the load order didn’t even cross my mind when I posted 🙂

I’m glad Josh helped you get it sorted.

Viewing 5 reply threads

The support post ‘EE4 – Change Single event Display settings’ 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