Last active
October 10, 2015 15:18
-
-
Save jo-snips/3710617 to your computer and use it in GitHub Desktop.
The Events Calendar: Custom Titles w/WP SEO
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
<?php | |
add_filter('wpseo_title','my_custom_titles'); | |
function my_custom_titles($title) { | |
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page | |
return 'Events Calendar'; | |
} elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages | |
return 'Events Calendar' . ' » ' . single_term_title('', false); | |
} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List | |
return 'Events List'; | |
} elseif( tribe_is_event() && is_single() ) { // Single Events | |
return get_the_title(); | |
} elseif( tribe_is_day() ) { // Single Event Days | |
return 'Events on: ' . date('F j, Y', strtotime($wp_query->query_vars['eventDate'])); | |
} elseif( tribe_is_venue() ) { // Single Venues | |
return $title; | |
} else { | |
return $title; | |
} | |
} | |
?> |
When displaying the title for events list if you start browsing the list clicking on "Next Events »" or "« Previous Events" the title disappears.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have added "global $wp_query;" and it seem to have fixed it. I'm not sure if it is correct.