Support

Home Forums Event Espresso Premium Change display order of event's main description and excerpt

Change display order of event's main description and excerpt

Posted: January 5, 2021 at 2:47 am


SmartPrep

January 5, 2021 at 2:47 am

Hi there

I am trying to re-order the display of a single event’s Main Description and Excerpt on the front-end.

As you can see here, I am having to put the main event information in the excerpt section in order for it to be displayed first, whilst the less important info is in the Main Description as it currently displays at the bottom of the single event page. I think we are using a custom single event template (it was made by one of our previous employees) so I am struggling to find the correct way to fix this. Please let me know if you can assist me in re-ordering the way these sections display.


Tony

  • Support Staff

January 5, 2021 at 5:30 pm

Hi there,

First, to confirm if you are using a custom template.

In your theme do you have a single-espresso_events.php template file?

If so, post the contents of that file to a Gist or Pastebin and I’ll take a look.


SmartPrep

January 6, 2021 at 1:43 am

This reply has been marked as private.


Tony

  • Support Staff

January 6, 2021 at 4:38 am

Line 60 is what is calling the excerpt, to call the event details in that location you’d need to move this:

<?php espresso_get_template_part( 'content', 'espresso_events-details' ); ?>

From line 66, up to remove line 60.

However, ‘espresso_events-header’ template also creates a header for the event, which you’ll lose when you remove that call so will need to add your own code (usually the_title()) to output the event title.

What output are you looking for on that page?


SmartPrep

January 6, 2021 at 1:38 pm

Ah ok, I see.

In div class="event-details right" I need info to appear in the following sequence:

Event Title
Main Description
Ticket Selector
Excerpt

Essentially the Main Description and Excerpt need to be swapped around. Please let me know what I need to do to achieve that.


Tony

  • Support Staff

January 7, 2021 at 4:16 am

Then you’ll need something like:

<header class="event-header">
    <?php echo "<h1 id=\"event-details-{$tag}-{$post->ID}\" class=\"entry-title\">"; ?>
        <a class="ee-event-header-lnk" href="<?php the_permalink(); ?>"<?php echo \EED_Events_Archive::link_target();?>>
            <?php the_title(); ?>
        </a>
    </h1>
</header>
<?php espresso_get_template_part( 'content', 'espresso_events-details' ); ?>
<?php espresso_get_template_part( 'content', 'espresso_events-tickets' ); ?>
<div class="event-details-excerpt">
    <?php the_excerpt(); ?>
</div>


SmartPrep

January 7, 2021 at 8:42 am

Hi Tony

Thanks a mil. It seems to work for the most part, however where I expect to see the content of the excerpt it’s only printing the words the_excerpt();

See HERE for screenshot example. Please let me know if I’m doing something wrong or if you can help me resolve.

Much appreciated!


Tony

  • Support Staff

January 7, 2021 at 1:02 pm

That’s not something you’ve done, it’s me missing the PHP tags around the function!

I’ve updated my snippet above so it should work now.


SmartPrep

January 8, 2021 at 2:14 am

Works like a charm. Thanks a mil!


Tony

  • Support Staff

January 8, 2021 at 7:04 am

You’re most welcome.

The support post ‘Change display order of event's main description and excerpt’ 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