Skip to content
Bill Erickson edited this page May 15, 2014 · 4 revisions

Using ACF instead of CMB

Add this to your theme/core functionality plugin: add_filter( 'be_events_manager_metabox_override', '__return_true' );

Install the Date and Time Picker extension. Use 'be_event_start' and 'be_event_end' as the start/end meta keys

Event Location

Install the Location Field extension. Add a location field to your metabox. Then use the following code in your theme:

<?php

$location = get_post_meta( get_the_ID(), 'be_event_location', true );
$location = explode( '|', $location );
echo '<p><img src="http://maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $location[0] ). '&zoom=13&size=600x300&maptype=roadmap&sensor=false" /></p>';

Event Time

<?php
	$start = get_post_meta( get_the_ID(), 'be_event_start', true );
	$end = get_post_meta( get_the_ID(), 'be_event_end', true );
	
	// Same date, same am/pm
	if( date( 'F j', $start ) == date( 'F j', $end ) && date( 'a', $start ) == date( 'a', $end ) )
		$time = date( 'g:i', $start ) . '&mdash;' . date( 'g:i a', $end );

	// Same date, different am/pm
	elseif( date( 'F j', $start ) == date( 'F j', $end ) )
		$time = date( 'g:i a', $start ) . '&mdash;' . date( 'g:i a', $end );

	// different date
	else
		$time = date( 'g:i a', $start ) . '&mdash;' . date( 'F j, g:i a', $end );
		
	echo '<p class="time">' . $time . '</p>';
Clone this wiki locally