Last active
June 1, 2017 19:16
-
-
Save macbookandrew/8aedd7809ddf89fabb6fc66a19bd0318 to your computer and use it in GitHub Desktop.
Adds dates to [the_grid] shortcode output for Modern Tribe’s The Events Calendar
This file contains hidden or 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
<?php | |
/* | |
* Plugin Name: The Events Calendar + The Grid | |
* Version: 1.0 | |
* Description: Adds dates to [the_grid] shortcode output for Tribe Events | |
* Author: AndrewRMinion Design | |
* Author URI: https://andrewrminion.com | |
* Plugin URI: https://gist.github.com/macbookandrew/8aedd7809ddf89fabb6fc66a19bd0318 | |
* License: GPL2 | |
*/ | |
/* | |
* Prevent this file from being accessed directly | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
/** | |
* Add begin and end dates to the_grid display | |
* @param string $excerpt HTML excerpt string | |
* @return string HTML excerpt string | |
*/ | |
function tribe_events_grid_dates( $excerpt ) { | |
if ( 'tribe_events' == get_post_type() && tribe_get_start_date() ) { | |
$post_id = get_the_ID(); | |
$excerpt = '<em class="tg-item-date event-dates">' . tribe_events_event_schedule_details() . '</em>' . $excerpt; | |
} | |
return $excerpt; | |
} | |
add_filter( 'get_the_excerpt', 'tribe_events_grid_dates' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changelog
v1.0: initial plugin