Skip to content

Instantly share code, notes, and snippets.

Created September 13, 2012 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3712948 to your computer and use it in GitHub Desktop.
Save anonymous/3712948 to your computer and use it in GitHub Desktop.
Overriding Events Calendar Pro titles when using YoastSEO
/*
* Parameters:
* $title: the original title (ie: Events for July, 2012)
* $separator: I believe it will be always null for this filter
* $date: The selected month in string format (ie: July, 2012)
*/
add_filter('wpseo_title','my_custom_titles');
function my_custom_titles($title) {
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
$title = 'Events Calendar | ' . get_bloginfo( 'name' );
} elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
$title = 'Upcoming Events | ' . get_bloginfo( 'name' );
} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List
$title = 'Upcoming Events | ' . get_bloginfo( 'name' );
} elseif( tribe_is_event() && is_single() ) { // Single Events
$title = 'Upcoming Events | ' . get_bloginfo( 'name' );
} elseif( tribe_is_day() ) { // Single Event Days
$title = 'Upcoming Events | ' . get_bloginfo( 'name' );
} else {
$title = 'Events | ' . get_bloginfo( 'name' );
}
return $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment