Created
September 13, 2012 08:42
-
-
Save anonymous/3712948 to your computer and use it in GitHub Desktop.
Overriding Events Calendar Pro titles when using YoastSEO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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