Created
September 21, 2021 16:09
-
-
Save lelandf/cc7d843cf55cb922d691649a6c148937 to your computer and use it in GitHub Desktop.
[TEC] Set doctitle to include event category name.
This file contains hidden or 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( 'pre_get_document_title', function( $title ){ | |
if ( is_tax( 'tribe_events_cat' ) ) { | |
$queried_object = get_queried_object(); | |
// Set title to: [Tribe Events Category Name] - [WordPress Site Title] | |
$title = $queried_object->name . ' - ' . get_bloginfo( 'name' ); | |
} | |
return $title; | |
}, 21, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works quite well with one exception: switching to Month view doesn't update the title correctly unless you refresh.