name ) && is_string( $term->name ) ) { return $term->name; } } elseif ( is_category() ) { /* translators: %s: Category name */ $txt = sprintf( __( 'Post category "%s"', 'marie' ), single_cat_title( '', false ) ); return $txt; } elseif ( is_day() ) { // For posts from 23rd November 2020... 'home/2020/11/23'. $y = get_the_time( 'Y' ); $m = get_the_time( 'F' ); $d = get_the_time( 'd' ); $txt = $d . ' ' . $m . ' ' . $y; return $txt; } elseif ( is_month() ) { // For posts from November 2020... 'home/2020/11'. $y = get_the_time( 'Y' ); $m = get_the_time( 'F' ); $txt = $m . ' ' . $y; return $txt; } elseif ( is_year() ) { return get_the_time( 'Y' ); } elseif ( is_single() && ! is_attachment() ) { return get_the_title(); } elseif ( is_home() ) { $blog_page_title = get_the_title( get_option( 'page_for_posts', true ) ); return $blog_page_title; } elseif ( ! is_single() && ! is_page() && get_post_type() !== 'post' && ! is_404() && ! is_search() ) { // This one is a post type archive. Eg. '/project(cpt)', '/youthclub(cpt)'. $post_type = get_post_type_object( get_post_type() ); if ( $post_type && is_object( $post_type ) ) { return $post_type->labels->plural_name; } } elseif ( is_attachment() ) { return get_the_title(); } elseif ( is_page() ) { // Regular page. Eg. '/resources'. if ( get_the_title() ) { return get_the_title(); } } elseif ( is_search() ) { /* translators: %s: search term. */ $txt = __( 'Search results', 'marie' ); // Eg. 'home/search results for whatever' (Page 1 of results). return $txt; } elseif ( is_tag() ) { // Eg. /tag/test-tag. /* translators: %s: name of current tag. */ $txt = sprintf( __( 'Posts tagged "%s"', 'marie' ), single_tag_title( '', false ) ); return $txt; } elseif ( is_author() ) { global $author; /* translators: %s: author name. */ $txt = sprintf( __( 'All posts by %s', 'marie' ), get_the_author_meta( 'display_name', $author ) ); return $txt; } elseif ( is_404() ) { return 'Page not found'; } } } }