Support

Home Forums Event Espresso Premium show hours in event summary

show hours in event summary

Posted: March 14, 2014 at 10:08 am


Gijsbert Vandeweerdt

March 14, 2014 at 10:08 am

Hello,

Is there a way to show the event times in the event summary?
We get questions from our customers about that.

Complete calendar is here: http://www.sintjansberg.be/agenda/

thank you, also for solving previous issues. Well done!
G


Tony

  • Support Staff

March 14, 2014 at 10:24 am

Hi Gijsbert,

The event times are displayed within the Calendar and the registration pages by default. http://take.ms/qyfyF

I may be misunderstanding your question. Could you explain a little more?
Possibly provide a screenshot outline where you would like the times?


Gijsbert Vandeweerdt

March 15, 2014 at 3:09 am

Yes, I should have been more clear.
I mean in this area: http://bit.ly/1gz70sE
You see a date and a price, but no hours.

This is the summary view, as defined with the ‘more’ code.

Hope this is clear?
thanks
gijsbert


Tony

  • Support Staff

March 17, 2014 at 4:20 am

Hi gijsbert,

I see now thank you 🙂

The event list does not include the event times by default and as such you would need to modify the event list templates to include these.

You’ll need to copy event_list.php and event_list_display.php to wp-content/uploads/espresso/templates/

Then in that location edit event_list_display.php. On lines 85-88 you should have something like this:

<p id="event_date-<?php echo $event_id ?>"><span class="section-title"><?php _e('Date:', 'event_espresso'); ?></span>  <?php echo event_date_display($start_date, get_option('date_format')) ?> 
<?php //Add to calendar button
echo apply_filters('filter_hook_espresso_display_ical', $all_meta);?>
</p>

You can provide full details or just times, here is an example with the full date and time details. Just replace the above lines with this:

<p id="event_date-<?php echo $event_id ?>"><span class="section-title">
<?php _e('Starts:', 'event_espresso'); ?></span>
<?php echo event_date_display($start_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->start_time, get_option('time_format')); ?>
<?php echo " "; //just a space ?>
</p>

<p><span class="section-title"><?php _e('Ends:', 'event_espresso'); ?></span>
<?php echo " "; //just a space ?>
<?php echo event_date_display($end_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->end_time, get_option('time_format')); ?>
<?php //Add to calendar button
echo apply_filters('filter_hook_espresso_display_ical', $all_meta);?>
</p>

Have those files within wp-content/uploads/espresso/templates/ keeps them ‘update safe’ and stops Event Espresso overwriting you customisations.


Gijsbert Vandeweerdt

March 17, 2014 at 2:53 pm

Thanks, it works.

I even modified your code with and if/else.
It works, only it doesn’t seem to execute the else ` <?php
if ( $start_date = $end_date ) {
?>

<p id=”event_date-<?php echo $event_id ?>”><span class=”section-title”>
<?php _e(‘Datum en tijd:’, ‘event_espresso’); ?></span>
<?php echo event_date_display($start_date, get_option(‘date_format’)); ?>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($event->start_time, get_option(‘time_format’)); ?>
<?php echo ” -> “; //just a space ?>
<?php echo event_date_display($event->end_time, get_option(‘time_format’)); ?>
<?php //Add to calendar button
echo apply_filters(‘filter_hook_espresso_display_ical’, $all_meta);?>
</p>
<?php } else { ?>
<p id=”event_date-<?php echo $event_id ?>”><span class=”section-title”>
<?php _e(‘Begin:’, ‘event_espresso’); ?></span>
<?php echo event_date_display($start_date, get_option(‘date_format’)); ?>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($event->start_time, get_option(‘time_format’)); ?>
<?php echo ” “; //just a space ?>
</p>

<p><span class=”section-title”><?php _e(‘Einde:’, ‘event_espresso’); ?></span>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($end_date, get_option(‘date_format’)); ?>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($event->end_time, get_option(‘time_format’)); ?>
<?php //Add to calendar button
echo apply_filters(‘filter_hook_espresso_display_ical’, $all_meta);?>
</p>

<?php } ?>`

What could this be?


Gijsbert Vandeweerdt

March 17, 2014 at 2:54 pm

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”> <?php
if ( $start_date = $end_date ) {
?>

<p id="event_date-<?php echo $event_id ?>"><span class="section-title">
<?php _e('Datum en tijd:', 'event_espresso'); ?></span>
<?php echo event_date_display($start_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->start_time, get_option('time_format')); ?>
<?php echo " -> "; //just a space ?>
<?php echo event_date_display($event->end_time, get_option('time_format')); ?>
<?php //Add to calendar button
echo apply_filters('filter_hook_espresso_display_ical', $all_meta);?>
</p>
<?php } else { ?>
<p id="event_date-<?php echo $event_id ?>"><span class="section-title">
<?php _e('Begin:', 'event_espresso'); ?></span>
<?php echo event_date_display($start_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->start_time, get_option('time_format')); ?>
<?php echo " "; //just a space ?>
</p>

<p><span class="section-title"><?php _e('Einde:', 'event_espresso'); ?></span>
<?php echo " "; //just a space ?>
<?php echo event_date_display($end_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->end_time, get_option('time_format')); ?>
<?php //Add to calendar button
echo apply_filters('filter_hook_espresso_display_ical', $all_meta);?>
</p>

<?php } ?>


Gijsbert Vandeweerdt

March 17, 2014 at 2:56 pm

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>
<?php
if ( $start_date = $end_date ) {
?>

<p id="event_date-<?php echo $event_id ?>"><span class="section-title">
<?php _e('Datum en tijd:', 'event_espresso'); ?></span>
<?php echo event_date_display($start_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->start_time, get_option('time_format')); ?>
<?php echo " -> "; //just a space ?>
<?php echo event_date_display($event->end_time, get_option('time_format')); ?>
<?php //Add to calendar button
echo apply_filters('filter_hook_espresso_display_ical', $all_meta);?>
</p>
<?php } else { ?>
<p id="event_date-<?php echo $event_id ?>"><span class="section-title">
<?php _e('Begin:', 'event_espresso'); ?></span>
<?php echo event_date_display($start_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->start_time, get_option('time_format')); ?>
<?php echo " "; //just a space ?>
</p>

<p><span class="section-title"><?php _e('Einde:', 'event_espresso'); ?></span>
<?php echo " "; //just a space ?>
<?php echo event_date_display($end_date, get_option('date_format')); ?>
<?php echo " "; //just a space ?>
<?php echo event_date_display($event->end_time, get_option('time_format')); ?>
<?php //Add to calendar button
echo apply_filters('filter_hook_espresso_display_ical', $all_meta);?>
</p>

<?php } ?>


Gijsbert Vandeweerdt

March 17, 2014 at 2:59 pm

[code language=”PHP”]
<?php
if ( $start_date = $end_date ) {
?>

<p id=”event_date-<?php echo $event_id ?>”><span class=”section-title”>
<?php _e(‘Datum en tijd:’, ‘event_espresso’); ?></span>
<?php echo event_date_display($start_date, get_option(‘date_format’)); ?>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($event->start_time, get_option(‘time_format’)); ?>
<?php echo ” -> “; //just a space ?>
<?php echo event_date_display($event->end_time, get_option(‘time_format’)); ?>
<?php //Add to calendar button
echo apply_filters(‘filter_hook_espresso_display_ical’, $all_meta);?>
</p>
<?php } else { ?>
<p id=”event_date-<?php echo $event_id ?>”><span class=”section-title”>
<?php _e(‘Begin:’, ‘event_espresso’); ?></span>
<?php echo event_date_display($start_date, get_option(‘date_format’)); ?>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($event->start_time, get_option(‘time_format’)); ?>
<?php echo ” “; //just a space ?>
</p>

<p><span class=”section-title”><?php _e(‘Einde:’, ‘event_espresso’); ?></span>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($end_date, get_option(‘date_format’)); ?>
<?php echo ” “; //just a space ?>
<?php echo event_date_display($event->end_time, get_option(‘time_format’)); ?>
<?php //Add to calendar button
echo apply_filters(‘filter_hook_espresso_display_ical’, $all_meta);?>
</p>

<?php } ?>
[/code]


Gijsbert Vandeweerdt

March 17, 2014 at 3:05 pm

Sorry for messing up with pasting the code, can’t delete posts I think.

Basically I’m doing this:

if start_date = end_date
display start_date + start_time + end_time
else
display the code you wrote
end if

It’s showing the if but not the ‘else’.


Sidney Harrell

March 17, 2014 at 4:43 pm

When you do a conditional test in php, you’ll want to use double equals for a “loose” matching, and a triple equals for an exact matching. With exact matching, the types have to be the same as well as the content, so

(42 == '42')

is true, but

(42 === '42')

is false. If you use a single equals, like it looks like you did, then it executes an assignment, then evaluates the result of the assignment. So

( $a = true )

assigns true to $a, and the whole expression is true, where

( $b = false )

assigns false to $b, and the whole expression is false. It’s a common mistake, and in fact many programmers will always put the variable at the end of the expression and what it is being compared to at the beginning, so that it will throw an error if they mistakenly put a single equals instead of a double. Like so

( false = $b )

The support post ‘show hours in event summary’ 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