Support

Home Forums Event Espresso Premium Using Custom Version Of The Toggle Template

Using Custom Version Of The Toggle Template

Posted: September 21, 2018 at 8:10 am

Viewing 11 reply threads


Phil Evans

September 21, 2018 at 8:10 am

Hi,

I’m adapting a custom version of template_file=espresso-events-table-template-toggle.template.php which I’ve renamed pe-template_file=espresso-events-table-template-toggle.template.php and it resides in my child theme directory.

Couple of quick questions,

– can I display the full venue address as well as the name?
– Can I display the Venue Google map below the address?
– can I display dates as Day, Date Month, Year – e.g. Fri 21 Sep 2018?

Add data to layout

There’s a test page here https://www.impactmh.org.uk/table-test/ – password is lemmein

Thanks

Phil


Josh

  • Support Staff

September 21, 2018 at 8:31 am

Hi Phil,

The toggle template just uses whatever date format is set in your site’s WP > Settings > General page. If you want to override the format used there, you can edit line 3 which has:

$date_format = get_option( 'date_format' );
to be:
$date_format = 'D j M Y';

Then add this template tag for the map:
<?php espresso_venue_gmap( $post->ID ); ?>

Then add this template tag for the venue address:
<?php espresso_venue_address('inline', NULL); ?>


Phil Evans

September 21, 2018 at 8:36 am

Thanks Josh. How can we get the start time to display after the date?
Cheers
Phil


Josh

  • Support Staff

September 21, 2018 at 8:44 am

Hi Phil,

Your screenshot shows the start time displaying after the date. So whatever you’ve changed that removed it, you’ll add that back.


Phil Evans

September 21, 2018 at 8:48 am

Hi Josh,

I haven’t changed anything that I can see. Here’s the code

<tr class="espresso-table-row <?php echo $category_slugs; ?>">
			<td class="event_title event-<?php echo $post->ID; ?>"><?php echo $post->post_title; ?></td>
			<?php if( $show_venues ) { ?>
				<td class="venue_title event-<?php echo $post->ID; ?>"><?php espresso_venue_name( NULL, FALSE ); ?>
				
				<?php espresso_venue_address('inline', NULL); ?>
				
				<?php espresso_venue_gmap( $post->ID ); ?>
				
				</td>
			<?php } ?>
			<td class="start_date event-<?php echo $post->ID; ?>" data-value="<?php echo $datetime->get_raw( 'DTT_EVT_start' ); ?>">
				<ul class="ee-table-view-datetime-list">
					<?php
						// Loop over each datetime we have pulled from the database and output
						foreach ($datetimes as $datetime) { 
						?>
							<li class="datetime-id-<?php echo $datetime->ID(); ?>">
								<?php echo date_i18n(  $date_format . ' ' . $time_format, strtotime( $datetime->start_date_and_time('Y-m-d', 'H:i:s') ) ); ?>
							</li>
					<?php 
						//end foreach $datetimes
						} 
					?>
				</ul>
			<td class="td-group reg-col" nowrap="nowrap"><?php echo $live_button; ?></td>
		</tr>

I can’t get the maps to display either.

Here’s a live page

https://www.impactmh.org.uk/mental-health-training-courses-and-services/mental-health-peer-support-in-bedfordshire-4-week-programme/#tab-id-2

Cheers

Phil


Phil Evans

September 21, 2018 at 9:13 am

Hi Josh,

I’ve got the start times to display by using

$date_format = 'D j M Y H:i a';

The only thing that’s not working now is the maps

I’ve added <?php espresso_venue_gmap( $post->ID ); ?> my php but nothing shows.

Thanks

Phil


Josh

  • Support Staff

September 21, 2018 at 9:13 am

Can you check to see if maybe you accidentally removed line 4 which sets the time format?
$time_format = get_option( 'time_format' );


Phil Evans

September 21, 2018 at 9:20 am

Ahhh. That’s it 🙂

I know have

// Options
$time_format		= get_option( 'time_format' );
$date_format 		= 'D j M Y';

And that’s working a treat.

Any idea why my venue maps aren’t displaying?

<?php espresso_venue_gmap( $post->ID ); ?>

Thanks

Phil


Josh

  • Support Staff

September 21, 2018 at 9:52 am

You could try a static map instead. Example code follows:

<?php $venue = '';
$venue = EEH_Venue_View::get_venue();
if ($venue instanceof EE_Venue) {
	echo EEH_Venue_View::espresso_google_static_map(
		$venue
	); 
} ?>


Phil Evans

September 21, 2018 at 10:00 am

Thanks Josh, does that just drop in between the <td> tags?


Josh

  • Support Staff

September 21, 2018 at 10:20 am

That’s up to you depending on where you want to put the map.


Phil Evans

September 21, 2018 at 10:21 am

Yep, that’s all working a treat. Thanks for the great support as always.

Have a good weekend.

Cheers

Phil

Viewing 11 reply threads

The support post ‘Using Custom Version Of The Toggle 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