Support » Themes and Templates » Header title

Header title

  • Hello,

    I have a question about the <title> tag. What can I do to let people see on what page of the website they are? Something like this:

    Home – My website
    Blog – My website

    <title>(page title) – Title website</title>

    What kind of codes do I have to use? I hope I’m clear.


Viewing 4 replies - 1 through 4 (of 4 total)
  • I think you will need to be a little more clear what you mean. Are you talking about in header.php and what shows at the top of your browser window?

    Yes, that’s what I’m trying to explain.

    do you mean this:
    <title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title>

    maybe try this:

    add the below code inside your functions.php, I assume your theme header.php has do_action(‘wp_head’) action filters.

    function my_custom_blog_title(){
    	$blogname  = $output = get_option('blogname');
    	$separator = ' &#187 '; // raquo >> chars		
    	if (is_home()):
    		$output .= wp_title($separator,false,'left');
    	elseif (is_search()):
    		$output  = sprintf(__('%1$s - Search results for: %2$s'),$blogname, wp_specialchars(get_query_var('s'), 1));
    		$output  .= __(' 404 Error: Page not found');
    		$output = wp_title($separator,false,'right').$blogname;
    	$output = '<title>'.$output.'</title>'.PHP_EOL;
    	echo apply_filters('my_custom_blog_title', $output);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Header title’ is closed to new replies.