Skip to content

Instantly share code, notes, and snippets.

@macbookandrew
Last active June 1, 2017 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macbookandrew/8aedd7809ddf89fabb6fc66a19bd0318 to your computer and use it in GitHub Desktop.
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
<?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' );
@macbookandrew
Copy link
Author

Changelog

v1.0: initial plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment