Created
July 3, 2020 09:50
-
-
Save farookibrahim/e1b746968279aa4e00012af854dbb2c2 to your computer and use it in GitHub Desktop.
Vodi - Movie archive page title customize
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
| 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