Skip to content

Instantly share code, notes, and snippets.

@theeventscalendar
theeventscalendar / Filter for new slug names.php
Last active August 29, 2015 14:22 — forked from anonymous/filter-tec-month-list-url-links.php
Makes the calendar respect new slug names
/**
* @param string $url
* @param string $type
* @return string
*/
function modify_month_list_link_urls( $url, $type ) {
if ( 'month' === $type ) return str_replace( 'month', 'calendar', $url );
if ( 'list' === $type ) return str_replace( 'list', 'all-events', $url );
if ( 'photo' === $type ) return str_replace( 'photo', 'picture-board', $url );
return $url;
@theeventscalendar
theeventscalendar / continual month pagination.php
Created June 4, 2015 22:31 — forked from barryhughes/continual-month-pagination.php
Let visitors page through all months (not just the populated date range)
/**
* Allows visitors to page forward/backwards in any direction within month view
* an "infinite" number of times (ie, outwith the populated range of months).
*/
class ContinualMonthViewPagination {
protected $tec;
public function __construct() {
add_filter( 'tribe_events_the_next_month_link', array( $this, 'next_month' ) );
add_filter( 'tribe_events_the_previous_month_link', array( $this, 'previous_month' ) );
@theeventscalendar
theeventscalendar / Hide end time
Created June 4, 2015 22:33
Hides event end times
// Function to hide end time in list, map, photo, and single event view
// NOTE: This will only hide the end time for events that end on the same day
add_filter( 'tribe_events_event_schedule_details_formatting', 'remove_end_time', 10, 2);
function remove_end_time( $formatting_details ) {
$formatting_details['show_end_time'] = 0;
return $formatting_details;
}
// Function to hide end time in Week and Month View Tooltips
@theeventscalendar
theeventscalendar / List Widget order by publication.php
Created June 4, 2015 22:35 — forked from barryhughes/list-widget-order-by-publication.php
Make one, some or all list widgets (advanced/PRO and regular/core) show events in publication order (most recent first)
class EventsListWidget_NewlyAddedEvents {
protected $constraints = array(
'sidebar_id' => null,
'widget_id' => null,
'widget_title' => null
);
public function __construct( array $constraints = array() ) {
$this->constraints = array_merge( $this->constraints, $constraints );
add_filter( 'widget_display_callback', array( $this, 'setup' ), 10, 3 );
@theeventscalendar
theeventscalendar / thumbnails in List Widget
Created June 4, 2015 22:38 — forked from ckpicker/gist:a754cbffa3c37b4a8c30
Add thumbnail images to the Upcoming Events List Widget
function custom_widget_featured_image() {
global $post;
echo tribe_event_featured_image( $post->ID, 'thumbnail' );
}
add_action( 'tribe_events_list_widget_before_the_event_title', 'custom_widget_featured_image' );
@theeventscalendar
theeventscalendar / bread crumbs for events and venues
Created June 4, 2015 22:39 — forked from ckpicker/gist:6875eb645a28df2a6db2
Adds bread crumb link support for events and venues in The Events Calendar
// Check if page is direct child
function is_child( $page_id ) {
global $post;
if( is_page() && ($post->post_parent != '') ) {
return true;
} else {
return false;
}
}
<ul class="tribe-events-sub-nav">
<li class="tribe-events-nav-previous">
<?php tribe_events_the_previous_month_link(); ?>
</li>
<!-- .tribe-events-nav-previous -->
<li class="tribe-events-nav-next">
<?php tribe_events_the_next_month_link(); ?>
</li>
<!-- .tribe-events-nav-next -->
@theeventscalendar
theeventscalendar / back to current month.php
Created June 5, 2015 23:01 — forked from elimn/back-to-current-month.php
Adds a Back to Current Month link at the bottom of the calendar
<?php if ( date_i18n( 'Y-m-01' ) !== tribe_get_month_view_date() ) : ?>
<li class="tribe-events-nav-current">
<a href="<?php echo Tribe__Events__Main::instance()->getLink( 'month' ) ?>">Back to Current Month</a>
</li>
<?php endif ?>
@theeventscalendar
theeventscalendar / custom month navigation sample.php
Created June 5, 2015 23:02 — forked from anonymous/custom-month-nav-sample.php
This is an example of a customized month navigation with a Return to Current Month link added.
<?php
/**
* Month View Nav Template
* This file loads the month view navigation.
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/month/nav.php
*
* @package TribeEventsCalendar
*
*/
@theeventscalendar
theeventscalendar / exclude events category.php
Last active November 27, 2022 03:30 — forked from elimn/tribe_exclude_events_category.php
Excludes specified categories from List and Month views. Add you own categories in line 9.
<?php
/*
* Removes categories "meetup" and "shindig" from list and month views
*/
function tribe_exclude_events_category( $wp_query ) {
// Slugs for the categories you wish to hide
$exclude_cats = array('meetup', 'shindig');