Page title | Site name in header
-
I’ve been puzzling over this off and on for weeks, and have read tons of articles and help topics on GeneratePress and other sites, but can’t seem to crack it. FYI, I’m using a GeneratePress child theme.
I just want to add the page title to the site name in the header for every page (except the home page. A wordpress article had this nice function for functions.php:
function wpdocs_filter_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'wpdocs_filter_wp_title', 10, 2 );
Then they say to put this in header.php:
<title><?php wp_title('|', true, 'right'); ?></title>
That doesn’t work, I guess because you’re using a whole different approach in header.php. It’s got a lot of hooks and stuff I can’t understand.
Thanks for any help.The page I need help with: [log in to see the link]
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Page title | Site name in header’ is closed to new replies.