Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active December 25, 2018 23:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cliffordp/9109ea4f072be52c3b923c224ab7eb2f to your computer and use it in GitHub Desktop.
Save cliffordp/9109ea4f072be52c3b923c224ab7eb2f to your computer and use it in GitHub Desktop.
MT - TEC - Custom Events Archive <title> (browser tab text)
<?php
/**
* MT - TEC - Custom Events Archive <title> (browser tab text)
*
* from https://gist.github.com/cliffordp/9109ea4f072be52c3b923c224ab7eb2f
* for https://theeventscalendar.com/support/forums/topic/how-to-rename-the-of-the-events-list/#post-1273004
*
* @return string
*/
function tribe_events_archive_custom_title( $title ) {
$my_custom_title = 'My Custom Events Archive Title'; // change this!!!
if ( ! class_exists( 'Tribe__Events__Main' ) ) {
return $title;
}
$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
$is_truly_admin = is_admin() && ! $is_ajax;
if ( is_post_type_archive( Tribe__Events__Main::POSTTYPE ) && ! is_single() && ! $is_truly_admin && is_main_query() ) {
$title = esc_html( $my_custom_title );
}
return $title;
}
add_filter( 'tribe_events_title_tag', 'tribe_events_archive_custom_title' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment