Skip to content

Instantly share code, notes, and snippets.

@farookibrahim
Created July 3, 2020 09:50
Show Gist options
  • Select an option

  • Save farookibrahim/e1b746968279aa4e00012af854dbb2c2 to your computer and use it in GitHub Desktop.

Select an option

Save farookibrahim/e1b746968279aa4e00012af854dbb2c2 to your computer and use it in GitHub Desktop.
Vodi - Movie archive page title customize
if( ! function_exists( 'vodi_child_mv_movie_page_title' ) ) {
function vodi_child_mv_movie_page_title( $page_title ) {
if ( is_search() ) {
/* translators: %s: search query */
$page_title = sprintf( __( 'Search results: “%s”', 'masvideos' ), get_search_query() );
if ( get_query_var( 'paged' ) ) {
/* translators: %s: page number */
$page_title .= sprintf( __( ' – Page %s', 'masvideos' ), get_query_var( 'paged' ) );
}
} elseif ( is_tax() ) {
$queried_object = get_queried_object();
if ( $queried_object ) {
$tax = get_taxonomy( $queried_object->taxonomy );
/* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term. */
$page_title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
}
} else {
$movies_page_id = masvideos_get_page_id( 'movies' );
$page_title = get_the_title( $movies_page_id );
if ( empty( $page_title ) ) {
$page_title = post_type_archive_title( '', false );
}
}
return $page_title;
}
}
add_filter( 'masvideos_movie_page_title', 'vodi_child_mv_movie_page_title', 99 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment