Support

Home Forums Event Espresso Premium EE4 Events Table View Template

EE4 Events Table View Template

Posted: December 19, 2014 at 7:43 am


mautin

December 19, 2014 at 7:43 am

Hi I would need the date of the Event Table Vie Template to show Start and End dates best without the time and the year at the end. i.e.
April 17 – April 20, 2015

Regards Michael


Lorenzo Orlando Caum

  • Support Staff

December 19, 2014 at 11:36 am

Hi Michael,

Try this:

https://gist.github.com/lorenzocaum/ac217033f12232404cce#comment-1359588

There are also other variations further up the page.


Lorenzo


mautin

December 19, 2014 at 4:53 pm

Hi Lorenzo,

thank you for the link. I was able to get the the start and end date to display but still have two issues.

1) I was not able to remove the time with the provided code.

2) It would be highly desirable if the year would be displayed only after the date.

April 17, – April 21, 2015

In addition if you would take a look at there is white space above the table that I can not get rid of.

Regards Michael


mautin

December 19, 2014 at 4:54 pm

the linke got removed

http://www.dev2.autin.com/courses/corporate-banking-and-finance/loan-agreements-syndication/


Lorenzo Orlando Caum

  • Support Staff

December 21, 2014 at 5:52 pm

Hi, it has the following parameters:

/**
* espresso_event_date_range
* returns the first and last chronologically ordered dates for an event (if different)
*
* @param string $date_format
* @param string $time_format
* @param string $single_date_format
* @param string $single_time_format
* @param bool $EVT_ID
* @return string
*/

I created another variation of the tutorial. This one has the date range without the time:

https://gist.github.com/lorenzocaum/ac217033f12232404cce#comment-1360330


Lorenzo


mautin

December 22, 2014 at 1:21 am

Hi Lorenzo,

thanks for the speedy response. Regrettably after changing the code the page stays blank now. http://www.dev2.autin.com/courses/corporate-banking-and-finance/loan-agreements-syndication/

Also I still have the problem with the white space before the table.

Regards Michael


Lorenzo Orlando Caum

  • Support Staff

December 22, 2014 at 8:40 am

Hi, I spotted a duplicate ‘echo’ which I’ve fixed and updated. Try again:

https://gist.github.com/lorenzocaum/ac217033f12232404cce#comment-1360330


Lorenzo


mautin

December 22, 2014 at 9:33 am

Hi Lorenzo,

thank you now it works πŸ™‚

I am still facing two issues:

1) Is it possible to have the year only at the end April 17, – April 21, 2015

2) There is a big amount of white space before the table that I can not get rid of.

http://www.dev2.autin.com/en/courses/corporate-banking-and-finance/loan-agreements-syndication/

Regards Michael


Lorenzo Orlando Caum

  • Support Staff

December 22, 2014 at 10:31 am

Hi, the table template shortcode appears to be wrapped in a pre code. Could you edit the WP page to remove that?

Regarding the year, I’m not sure if that is possible so I’ll check with a team member.


Lorenzo


mautin

December 22, 2014 at 10:34 am

Hi Lorenzo, that with the <pre> was my bad sry. Got rid of it!

And yes please check with your team that would be very important for me.

Regards Michael

  • This reply was modified 9 years, 4 months ago by  Tony. Reason: code formatting


mautin

December 23, 2014 at 2:00 am

Hi again, hopefully my last request πŸ˜‰

How can I have a message appear when there is no event with the given parameters of the table view.

e.g. I have a category set and there is no event in that category then a message should appear: No event scheduled! (or similar)

Regard Michael


Dean

December 23, 2014 at 8:46 am

Hi,

The date *can* be changed but it would be a template edit, which we don’t recommend as updates will over write the changes.

If that’s ok, edit /wp-content/plugins/eea-events-table-view-template/templates/espresso-events-table-template.template.php and on line 99 replace

$startdat = $datetime->start_date_and_time();

with

$startdat = $datetime->start_date_and_time($dt_frmt = 'd m', $tm_format = NULL );

Obviously the ‘d m’ would need to be changed to the correct date format you want: http://php.net/manual/en/datetime.formats.date.php

“How can I have a message appear when there is no event with the given parameters of the table view.”

It should display the “no content” template part. Can you provide the shortcode and parameters you are using and a brief mention of how the events are set up, I’d like to see why the message isn’t showing for you.


mautin

December 29, 2014 at 12:29 am

Hi Guys, I hope you had enjoyable holidays!

Concerning the first issue about the date:

I tried modifying the template but the output remained exactly the same. I am using the last Date View alteration from here https://gist.github.com/lorenzocaum/ac217033f12232404cce#comment-1360330 should this be the problem ?

What I would ultimately hope to have is a line of code where I have Start Date ( d M) and End Date (d M o) and I could modify the date style to my liking.

Concerning the not showing of no course:

The short code I use is: [ESPRESSO_EVENTS_TABLE_TEMPLATE table_search = false category_filter = false category_slug = test]

I believe there is nothing unusual about my event set up. Start and end a few ticket and a category.

I could gladly provide you access to my site if that helps for either of the issues.

Regards Michael


Josh

  • Support Staff

December 29, 2014 at 8:43 pm

Hi there,

Yes, if you’re using Lorenzo’s suggested method, changing the variables in Dean’s suggestion will not change the date output. This is because Lorenzo’s method doesn’t use $startdat = $datetime->start_date_and_time();

To get your desired date output, you’ll need to 1) add end dates to the loop where it grabs dates for each event and 2) change the date format where the date is output.

Please start with a fresh copy of the table template because the following directions will not work if you’re starting with Dean and Lorenzo’s modifictions.

1) add the end date to the loop:


foreach ( $datetimes as $datetime ) {
  $startdat = $datetime->start_date_and_time();
  $enddat = $datetime->end_date_and_time(); // <-- end date
}

2) Change the date output so that it includes a start date, a separator, end date, and uses the desired formatting:

<td class="start_date event-<?php echo $post->ID; ?>" 
  data-value="<?php echo strtotime( $startdat ); ?>">
<?php echo date_i18n( 'F j', strtotime( $startdat ) ) // <-- start date
  . ' - ' // <-- separator
  . date_i18n( 'F j, Y', strtotime( $enddat )); // <-- end date 
?>
</td>

Then, to add a message for when there are no upcoming events listed, you add your messageafter the line near the bottom of the template that says else :. The else means “If there are no events, then do this”. Here’s an example of what you can add:

echo '<h4>No events scheduled</h4>';


Josh

  • Support Staff

December 29, 2014 at 8:54 pm

Update: I don’t like how the forum software formats the code in the above reply. Here’s a link to a gist that shows all the modifications within the template file:

https://gist.github.com/joshfeck/4ff79f26eb48a8e0804f

The support post ‘EE4 Events Table View Template’ 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