Skip to content

Instantly share code, notes, and snippets.

View alaasalama's full-sized avatar

Alaa AlDin Salama alaasalama

View GitHub Profile
@alaasalama
alaasalama / functions.php
Created March 13, 2019 19:21
Alter the shortcode logic to be AND instead of OR
/* Tribe, change tax query relation to AND instead of OR */
function tribe_list_widget_tax_query_relation ( $args ) {
    // bail if no relation is no tax query
    if ( !isset( $args['tax_query'] ) ) return $args;
    $args['tax_query']['relation'] = 'AND';
    return $args;
}
@alaasalama
alaasalama / remove-categories-not-replated.php
Last active April 24, 2019 10:21 — forked from jesseeproductions/remove-categories-not-replated.php
removes "'concert', 'convention'" categories from month view only
/*
* The Events Calendar Remove Events from Month and List Views
* add coding to theme's functions.php
* @version 3.12
* modify here with event category slugs: array( 'concert', 'convention' )
*/
add_action( 'pre_get_posts', 'tribe_exclude_events_category_month_list' );
function tribe_exclude_events_category_month_list( $query ) {
if ( isset( $query->query_vars['eventDisplay'] ) && ! is_singular( 'tribe_events' ) ) {
@alaasalama
alaasalama / example.php
Last active October 9, 2019 09:44 — forked from skyshab/example.php
Customize the events month view title
<?php
add_filter('tribe_get_events_title', 'my_custom_events_title');
function my_custom_events_title( $title ) {
$events_label_plural = tribe_get_event_label_plural();
if ( tribe_is_month() ) {
$title = sprintf(
esc_html_x( '%1$s %2$s %3$s', 'month view', 'the-events-calendar' ),
$events_label_plural,
'for',
date_i18n( tribe_get_date_option( 'monthAndYearFormat', 'F Y' ), strtotime( tribe_get_month_view_date() ) )