Skip to content

Instantly share code, notes, and snippets.

View vicskf's full-sized avatar

Victor Zarranz vicskf

View GitHub Profile
@vicskf
vicskf / functions.php
Created December 19, 2019 00:49
TEC > V2 > Change views breakpoints
<?php
add_filter( 'tribe_events_views_v2_view_breakpoints', function( $breakpoints, $view ) {
return [
//change the following values to the desired ones
'xsmall' => 500,
'medium' => 768,
'full' => 960,
];
}, 10, 2 );
@vicskf
vicskf / change_events_view_titles.php
Last active December 10, 2019 13:59 — forked from theeventscalendar/change_events_view_titles.php
Changes the title/headings on Events views
<?php
/*
* Alters event's archive titles
*/
function tribe_alter_event_archive_titles ( $original_recipe_title, $depth ) {
// Modify the titles here
// Some of these include %1$s and %2$s, these will be replaced with relevant dates
$title_upcoming = 'Upcoming Events'; // List View: Upcoming events
@vicskf
vicskf / functions.php
Last active September 6, 2019 20:17
Eventbrite Tickets: Temporary workaround for Eventbrite cost issue #133823
<?php
/**
* This will enable the cost field for Eventbrite imported events in the admin
* Add this code to your active theme's functions.php file
* Important Note: No cost will be displayed for Eventbrite events if none is manually set.
*/
if ( class_exists( 'Tribe__Events__Tickets__Eventbrite__Main' ) ) {
@vicskf
vicskf / force_cost.php
Last active March 8, 2019 18:47 — forked from GeoffEW/force_cost.php
/* Force the use of the cost field of event and ignore tickets price */
<?php
/* Force the use of the cost field of event and ignore tickets price */
function tribe_just_show_price_field ( $cost, $post_id, $with_currency_symbol ) {
$cost_utils = tribe( 'tec.cost-utils' );
$cost = tribe_get_event_meta( $post_id, '_EventCost' );
if ( $with_currency_symbol ) {
$cost = $cost_utils->maybe_format_with_currency( $cost );
}
@vicskf
vicskf / functions.php
Created February 11, 2019 14:27
TEC > Add support for author metabox in organizer post type
<?php
/**
* Enable author support for organizer posts.
*
* @param array $args
* @return array
*/
function tribe_organizers_author_support( $args ) {
$args['supports'][] = 'author';
return $args;
@vicskf
vicskf / single-event.php
Created September 14, 2018 12:08
Events Calendar PRO > Single Event Template for Widgets - To always show the featured image regardless of the event being featured or not
<?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
*
@vicskf
vicskf / functions.php
Created July 9, 2018 12:34
TEC > Creates a menu location for the main events template
<?php
function register_my_menu() {
register_nav_menu( 'main-events', __( 'Main Events Categories' ) );
}
add_action( 'init', 'register_my_menu' );
add_action( 'tribe_events_before_template', 'main_events_custom_menu' );
function main_events_custom_menu () {
wp_nav_menu( array( 'theme_location' => 'main-events' ) );
@vicskf
vicskf / functions.php
Created July 2, 2018 12:31
TEC > Remove default "iCal Export" link in main events view and replace with a custom link
<?php
// Do not show "iCal Export" link
add_filter( 'tribe_events_list_show_ical_link', '__return_false' );
// Add custom "iCal Export" link
add_action( 'tribe_events_after_footer', 'custom_events_ical_link', 20, 1 );
/**
* Generates the markup for the "iCal Export" link for the views.
*/
@vicskf
vicskf / functions.php
Last active October 21, 2020 18:54
TEC > Customize The Events Calendar iCal links to add a rel="nofollow" attribute to the links for SEO purposes
<?php
/**
* Customize The Events Calendar iCal links to add a rel="nofollow" attribute to the links for SEO purposes
*/
add_filter( 'tribe_events_ical_single_event_links', 'my_custom_events_ical_single_event_links' );
function my_custom_events_ical_single_event_links( $calendar_links ) {
$calendar_links = '<div class="tribe-events-cal-links">';
$calendar_links .= '<a class="tribe-events-gcal tribe-events-button" rel="nofollow" href="' . Tribe__Events__Main::instance()->esc_gcal_url( tribe_get_gcal_link() ) . '" title="' . esc_attr__( 'Add to Google Calendar', 'the-events-calendar' ) . '">+ ' . esc_html__( 'Google Calendar', 'the-events-calendar' ) . '</a>';
$calendar_links .= '<a class="tribe-events-ical tribe-events-button" rel="nofollow" href="' . esc_url( tribe_get_single_ical_link() ) . '" title="' . esc_attr__( 'Download .ics file', 'the-events-calendar' ) . '" >+ ' . esc_html__( 'iCal Export', 'the-events-calendar' ) . '</a>';
@vicskf
vicskf / functions.php
Last active April 17, 2018 12:04
Event Tickets > For ticketed events, it filter the event cost to only consider ticket price if on sale.
<?php
/**
* For ticketed events, it filter the event cost to only consider ticket price if on sale.
*
* From: https://gist.github.com/vicskf/e9f4763809d825a2b768fe83a945c2fd
*/
add_filter( 'tribe_get_cost', 'custom_tribe_get_cost', 10, 3 );
function custom_tribe_get_cost ( $cost, $post_id, $with_currency_symbol ) {