Skip to content

Instantly share code, notes, and snippets.

View jmarchwinski's full-sized avatar

Jaime jmarchwinski

  • New York
View GitHub Profile
@jmarchwinski
jmarchwinski / functions.php
Last active July 21, 2020 15:01
Hide past events from wordpress search
// Exclude past events from search
function mySearchFilter($query) {
if ($query->is_search) {
$past_events = tribe_get_events( array(
'posts_per_page' => -1,
'end_date' => new DateTime()
) );
$exclude_events = [];
foreach ( $past_events as $past_event ) {
$exclude_events[] = $past_event->ID;
@jmarchwinski
jmarchwinski / functions.php
Last active July 8, 2020 14:43 — forked from cliffordp/functions.php
Events Calendar PRO: Change default coordinates and zoom level for Map View's start location (for when there are no event results found, to avoid African coast).
<?php
/**
* Events Calendar PRO: Change default coordinates and zoom level for Map View's
* start location (for when there are no event results found, to avoid African coast).
*
* Change the coordinates to your liking. See the link below for a helpful tool.
* Updated 2018-08-06 because PRO v4.4.30 removed one of the parameters.
*
* @link https://gist.github.com/cliffordp/52d0bfb6d1537a19d158deb351dd9fa7
add_filter( 'tribe_get_event_website_link_label', 'tribe_get_event_website_link_label_default' );
function tribe_get_event_website_link_label_default( $label ) {
if ( $label === tribe_get_event_website_url() ) {
$label = "Visit Website »";
return '<a href="'https://events.vtools.ieee.org/meetings/ical/0/90/asc/1/NEW%20HAMPSHIRE . tribe_get_event_website_url() . '">' . $label . '</a>';
}
return $label;
@jmarchwinski
jmarchwinski / functions.php
Created November 18, 2019 18:56
Filter Bar Category Additional Options
<?php
/**
* Customized version of the Category Filter that includes CSS classes for subcategories
* New filter available in WP-Admin > Events > Settings > Filters
*/
if ( class_exists( 'Tribe__Events__Filterbar__Filters__Category' ) ) {
class Tribe__Events__Filterbar__Filters__Category_Custom extends Tribe__Events__Filterbar__Filters__Category {
/**
* Flatten out the hierarchical list of event categories into a single list of values,
* applying formatting (non-breaking spaces) to help indicate the depth of each nested
@jmarchwinski
jmarchwinski / pro\widgets\modules\single-event.php
Last active September 26, 2019 12:59
Adds featured image to widgets
<?php
/**
* Single Event Template for Widgets
*
* This template is used to render single events for both the calendar and advanced
* list widgets, facilitating a common appearance for each as standard.
*
* You can override this template in your own theme by creating a file at
* [your-theme]/tribe-events/pro/widgets/modules/single-event.php
*
<?php
/*
* EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
* See the codex to learn more about WP text domains:
* http://codex.wordpress.org/Translating_WordPress#Localization_Technology
* Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
*/
function tribe_custom_theme_text ( $translation, $text, $domain ) {
@jmarchwinski
jmarchwinski / filter-bar-open.css
Created November 21, 2017 13:46
Filter Bar Open
.tribe_events_filter_item.closed div {
display: inherit !important;
}
.tribe-events-filters-horizontal .tribe-events-filter-group {
max-width: 100%;
width: 100%;
background: none;
border: none;
-webkit-box-shadow: none;
@jmarchwinski
jmarchwinski / change-start-time.php
Created November 16, 2017 14:55
Change start time
add_filter( 'tribe_events_week_get_hours', 'filter_week_hours' );
function filter_week_hours( $hours ) {
$hour = 0;
foreach ( $hours as $key => $formatted_hour ) {
if ( $hour < 7 || $hour > 18 ) {
unset( $hours[ $hour ] );
}
@jmarchwinski
jmarchwinski / photo-view-reverse.php
Created November 1, 2017 11:18
Photo View Reverse Chronology
// Changes PHOTO VIEW listed event views to reverse chronological order
function tribe_past_reverse_chronological ($post_object) {
$past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'upcoming') ? true : false;
if(tribe_is_past() || tribe_is_photo() || tribe_is_upcoming() || $past_ajax) {
$post_object = array_reverse($post_object);
}
return $post_object;
}
add_filter('the_posts', 'tribe_past_reverse_chronological', 100);