Support

Home Forums Event Espresso Premium Event showing post date not start date

Event showing post date not start date

Posted: November 25, 2015 at 3:46 am


Auric

November 25, 2015 at 3:46 am

Hi, on this page – http://corp.capechamber.auric-consulting.com/events/, you can see the events all showing as happening on the 23rd of November, this is the dates the events were posted not the start date configured in Event Espresso. What’s wrong?


Tony

  • Support Staff

November 25, 2015 at 4:34 am

Hi there,

With Event Espresso you can have multiple ‘datetimes’ within an event, so the post date (which is what your theme is outputting on that archive listing) will always be the date the event was created.

To fix this you’ll need to alter template used to output those details, is this a custom theme or one you have purchased?


Auric

November 25, 2015 at 5:37 am

It’s a theme called Directory+. The theme author’s support is laughable. If you can let me know what to change I can probably sort it out.


Tony

  • Support Staff

November 25, 2015 at 5:55 am

I would recommend creating a child theme rather the modifying the theme files directly.

When which template file is being loaded on that page, you can use a plugin such as What The File to find this. Install the plugin, load the page whilst logged in and view the templates loaded within the admin bar.

You’ll likely find it’s the archive.php file and it could be loading other template parts within that.

Find which file is loading the post date and copy that into your child theme, then within a espresso_events post type check:

if ( 'espresso_events' == get_post_type() ) {
// Run code specifically for EE events
}

You’ll need to grab the datetimes for the event and use the next upcoming datetime. Here is an example of how to pull the next upcoming datetime for an event:

https://gist.github.com/Pebblo/f4d151e4784c6aa67a3d

So then within the correct sections you can use:

//echo the day
$datetime->e_start_date('d');

//echo the month
$datetime->e_start_date('M');

//echo the year
$datetime->e_start_date('Y');

Again you’ll want to wrap that in a espresso_events post type check to output those details for EE events, but the original details for other post types.


Auric

November 25, 2015 at 6:51 am

Here’s what I don’t understand. This was working correctly until some point, not sure when. But this is the page auto-generated by Event Espresso as defined in the Event Listings URL.
We have a child theme so I’ll look at this now.


Tony

  • Support Staff

November 25, 2015 at 7:29 am

Here’s what I don’t understand. This was working correctly until some point, not sure when.

The post date of the event post has never been the actual event date as that is actually the datetime date. So I’m not sure how this worked previously if theme used the those details.

But this is the page auto-generated by Event Espresso as defined in the Event Listings URL.

The output is not auto generated by Event Espresso, it is auto generated by your theme we just hook in and inject the event details to the content.

The /events/ listing is an archive of the espresso events post type so your theme outputs the archive and EE hooks into ‘the_content’ and adds the event details to that. We do not hook in and output a date like it is displayed on your current page, that’s all your theme using the post date.

Please let me know how you get on.


Auric

November 25, 2015 at 7:34 am

Please let me know how you get on.

Completely lost


Auric

November 25, 2015 at 7:37 am

I’ve activated the plug and found that archive.php is loading, here are the contents…

{block content}
{* template for page title is in parts/page-title.php *}
{if $wp->havePosts}
{if $wp->isAuthor and $author->bio}
{includePart parts/author-bio}
{/if}
{loop as $post}
{includePart parts/post-content}
{/loop}
{includePart parts/pagination, location => pagination-below}
{else}
{includePart parts/none, message => no-posts}
{/if}

After that, no idea.


Auric

November 25, 2015 at 7:59 am

I *think* parts/post-content is the file to change by the looks of things.


Tony

  • Support Staff

November 26, 2015 at 4:53 am

Hi Auric,

Looking at the above it does look like the /parts/post-content/ template file is the template you need to copy over and modify.

However that file may also call other templates so it depends on the contents.

Looking at the shortcode for the page you linked – http://take.ms/t5gWO

I would search the theme for link-day/month/year and short-date classes to narrow down where that output is coming from.


Auric

November 26, 2015 at 7:27 am

Here’s the bit of parts/page-content.php that relevant.

<div class=”entry-thumbnail-desc”>

{var $dateIcon = $post->date}
{var $dateLinks = ‘no’}
{var $dateShort = ‘yes’}

{includePart parts/entry-date-format, dateIcon => $dateIcon, dateLinks => $dateLinks, dateShort => $dateShort}

<div class=”entry-title”>
<div class=”entry-title-wrap”>
<h2>permalink}”>{!$post->title}</h2>
</div><!– /.entry-title-wrap –>
</div><!– /.entry-title –>

{if $post->hasImage}
<div class=”more-wrap”>
permalink}” class=”more”>{!__ ‘read more’}
</div>
{/if}

</div>

If I delete the three var lines the date disappears. How do I change it to show the event date?


Auric

November 26, 2015 at 7:33 am

then within a espresso_events post type check:

What does that mean?


Auric

November 26, 2015 at 7:38 am

The code for the dates is in entry-date.php. That’s also in /parts.


Tony

  • Support Staff

November 26, 2015 at 8:05 am

Can you send me a copy of the theme please, I need to view the code to see whats happening.

You can email a copy to support[at]eventespresso.com although depending on the size you may need to host the file and send us a link to download if from that.


Auric

November 26, 2015 at 8:15 am

**REMOVED – Tony **

  • This reply was modified 8 years, 5 months ago by  Tony. Reason: Remove link


Auric

November 26, 2015 at 8:17 am

I’m not a programmer, I do Microsoft infrastructure so this stuff is mumbo jumbo to me


Tony

  • Support Staff

November 26, 2015 at 12:34 pm

Your theme is using some kind of template engine, so that code above is not something I’m used to myself.

I did manage to make this work locally and have a template you can use.

Download this – http://take.ms/oGxkt

Within your child theme, place that file within a /parts/ directory.

So you’ll have /directory2-child/parts/entry-date-format.php

The date will then pull the date from your next upcoming datetime.

It checks if we are dealing with a espresso_events post type using:

if ( 'espresso_events' == get_post_type() ) {
// Run code specifically for EE events
}

Then if we are it outputs the same details, only using the events datetime, if not it outputs the same as it usually would.

I need to note that whilst I have provided the above, we can not provide further support for this, the theme works differently than most. If you have further problems with this you may need to create a ticket with the theme developers so they can provide a ‘proper’ template for this.


Auric

November 27, 2015 at 12:40 am

Tony, you’re a legend. It’s working as expected. The annoying thing is that now that I see the code you wrote I’m thinking ‘Oh, it was that easy, was it?’ But I will admit I was lost. Of course, internally I’m going to take all the credit :P.
I hear you about the theme being different to others. The the theme and the page builder it comes with are actually pretty good and incredibly flexible but unfortunately the support from the theme authors offer is terrible, close to the worst I have ever experienced.

Many thanks, Graham


Tony

  • Support Staff

November 27, 2015 at 2:03 am

Yep, all of the info was in this post it just needed to be put togeth in the right place.

I’m glad it helped, have a great weekend 🙂

The support post ‘Event showing post date not start date’ 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