Skip to content

Instantly share code, notes, and snippets.

@lepittenger
Last active February 22, 2016 23:20
Show Gist options
  • Save lepittenger/fe20b1488c4a6fac5ebd to your computer and use it in GitHub Desktop.
Save lepittenger/fe20b1488c4a6fac5ebd to your computer and use it in GitHub Desktop.
events calendar plugin with genesis
<?php
/**
* The Events Calendar - Bypass Genesis genesis_do_post_content in Event Views
*
* This snippet overrides the Genesis Content Archive settings for Event Views
*
* Event Template set to: Admin > Events > Settings > Display Tab > Events template > Default Page Template
*
* The Events Calendar @4.0.4
* Genesis @2.2.6
*/
add_action( 'get_header', 'tribe_genesis_bypass_genesis_do_post_content' );
function tribe_genesis_bypass_genesis_do_post_content() {
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) {
if ( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() || ( tribe_is_recurring_event() && ! is_singular( 'tribe_events' ) ) ) {
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'the_content', 15 );
}
} elseif ( class_exists( 'Tribe__Events__Main' ) && ! class_exists( 'Tribe__Events__Pro__Main' ) ) {
if ( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) {
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'the_content', 15 );
}
}
}
/*
* Genesis Page Layout of The Event Calendar Main Events Templates (Month, List, Photo, Etc..)
* The Events Calendar @3.10
* Genesis @2.1.2
* Options - full-width-content, content-sidebar, sidebar-content, content-sidebar-sidebar, sidebar-sidebar-content, sidebar-content-sidebar
*/
//Target all Event Views (Month, List, Map etc)
add_filter( 'genesis_site_layout', 'tribe_genesis_view_layouts' );
function tribe_genesis_view_layouts() {
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) {
return 'content-sidebar';
}
} elseif ( class_exists( 'Tribe__Events__Main' ) && !class_exists( 'Tribe__Events__Pro__Main' ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) {
return 'content-sidebar';
}
}
}
/*
* Genesis Layout of The Event Calendar Views for all Templates
* The Events Calendar @3.10
* Genesis @2.1.2
* Options - full-width-content, content-sidebar, sidebar-content, content-sidebar-sidebar, sidebar-sidebar-content, sidebar-content-sidebar
*/
//Target all Event Views (Month, List, Map etc), Single Events, Single Venues, and Single Organizers
add_filter( 'genesis_site_layout', 'tribe_genesis_all_layouts' );
function tribe_genesis_all_layouts() {
if( class_exists( 'Tribe__Events__Main' ) && tribe_is_event_query() ) {
return 'content-sidebar';
}
}
/*
* Genesis Layout of The Event Calendar Single Templates
* Options - full-width-content, content-sidebar, sidebar-content, content-sidebar-sidebar, sidebar-sidebar-content, sidebar-content-sidebar
*/
//Target Single Events, Single Venues, and Single Organizers
add_filter( 'genesis_site_layout', 'tribe_genesis_single_layouts' );
function tribe_genesis_single_layouts() {
if( is_singular( 'tribe_events' ) || is_singular( 'tribe_venue' ) || is_singular( 'tribe_organizer' ) ) {
return 'content-sidebar';
}
}
/*
* The Events Calendar - Fix Mobile Month View in Genesis 2.2.6
* @version 1.0
*/
add_filter( 'post_class', 'tribe_genesis_event_class_hentry' );
function tribe_genesis_event_class_hentry( $classes ) {
$event_class = 'hentry';
if ( tribe_is_event_query() ) {
$classes[] = esc_attr( sanitize_html_class( $event_class ) );
}
return $classes;
}
/*
* Remove Genesis Breadcrumbs from the Event Calendar View Pages
* The Events Calendar @3.8
* Genesis @2.1.2
*/
add_action( 'genesis_before', 'tribe_remove_genesis_breadcrumbs' );
function tribe_remove_genesis_breadcrumbs() {
if( tribe_is_upcoming() || tribe_is_past() || tribe_is_map() || tribe_is_photo() || tribe_is_month() || tribe_is_week() || tribe_is_day() || tribe_is_photo() ) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
}
}
/*
* Genesis Remove Genesis Meta Filter on Event Calendar Pages
* The Events Calendar @3.8
* Genesis @2.1.2
*
*/
add_action( 'genesis_doctype', 'tribe_genesis_meta_title' );
function tribe_genesis_meta_title() {
if( tribe_is_upcoming() || tribe_is_past() || tribe_is_map() || tribe_is_photo() || tribe_is_month() || tribe_is_week() || tribe_is_day() || tribe_is_photo() ) {
remove_action( 'genesis_title', 'genesis_do_title' );
add_action( 'genesis_title', 'event_genesis_do_title', 10 );
//remove_filter( 'wp_title', 'genesis_default_title', 10, 3 );
}
}
/**
* Output Genesis title
*
*/
function event_genesis_do_title() {
echo '<title>';
wp_title( '|', true, 'right' );
echo '</title>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment