• 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.

    Regards,

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?

    Thread Starter 723406

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

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

    maybe try this:
    https://wpcandy.com/articles/tutorials/the-wordpress-help-sheet.html

    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));
    
    	elseif(is_404()):
    		$output  .= __(' 404 Error: Page not found');
    
    	else:
    		$output = wp_title($separator,false,'right').$blogname;
    
    	endif;
    
    	$output = '<title>'.$output.'</title>'.PHP_EOL;
    
    	echo apply_filters('my_custom_blog_title', $output);
    }	
    
    add_action('wp_head','my_custom_blog_title');
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Header title’ is closed to new replies.