Created
February 13, 2018 00:20
-
-
Save tomfinitely/b281ecebd36e3682dac9258804c59308 to your computer and use it in GitHub Desktop.
Events Calendar Pro + Genesis Sandbox Featured Content Widgets Modifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* ------------------------------------------------- | |
// ---------- GSFC + TEC Customization --------------- *// | |
//* Event Secondary Thumbnail Call | |
add_action ( 'gsfc_before_post_content', 'add_event_thumb', 1); | |
function add_event_thumb() { | |
$attr = array( | |
'class' => "event-thumb", // set custom class | |
'data-adaptive-background' => "1" | |
); | |
$post_thumbnail = MultiPostThumbnails::the_post_thumbnail('tribe_events', 'featured-image-2', NULL, 'events-thumb-lg', $attr); | |
echo $post_thumbnail; | |
} | |
//* Outer Wrapper Injection | |
add_action ( 'gsfc_before_post_content', 'add_outer_wrap', 2); | |
function add_outer_wrap() { | |
echo '<div class="outer-wrap">'; | |
} | |
//* Modify the Event Entry Output | |
add_action ( 'gsfc_post_content','add_event_info', 1); | |
function add_event_info(){ | |
global $post; | |
echo '<div class="inner-wrap">'; | |
if (tribe_get_start_date() !== tribe_get_end_date() ) { | |
echo '<div class="info">' . tribe_events_event_schedule_details( null, false) . '</div> '; | |
} else { | |
echo '<div class="all-day info"> | |
<meta itemprop="startDate" content="' . tribe_get_start_date( null, false) . '"/>' . tribe_get_start_date( null, false, 'F jS' ) . '</div>'; | |
} | |
if(tribe_get_venue()) { | |
echo '<div class="venue">' . tribe_get_venue_link( get_the_ID() ) . '</div>'; | |
} | |
} | |
//* Throw in Some Event Button CTAs at the End | |
add_action ('gsfc_after_post_content', 'add_event_buttons', 11); | |
function add_event_buttons() { | |
$post_id = null; | |
$buy = get_field( 'buy_link' ); | |
global $post; | |
echo '<a href="' . get_permalink($post->ID) . '" class="button details">Event Details</a>'; | |
if ( $buy ) { | |
echo '<a href="' . $buy . '" class="button buy">Get Tickets</a>'; | |
} | |
echo '</div>'; | |
} | |
//* Inject a closing div to wrap it all up | |
add_action ( 'gsfc_after_post_content', 'end_outer_wrap', 12); | |
function end_outer_wrap() { | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment