Support » Theme: Storefront » Page title in two colors

  • Resolved hastic

    (@hastic)


    Hi, how I can add two different styles in page title?

    Example: <span style=”color:#000″>Store</span><span style=”color:#ddd”>Front</span>

    In personalization theme I can’t add <span style…> on site identity.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,

    I believe WordPress will strip any HTML you add to your site title, so you’d have to do this with a snippet. If you add the following to wherever you add your snippets you’ll be able to customize your title;

    
    function storefront_site_title_or_logo( $echo = true ) {
    		if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
    			$logo = get_custom_logo();
    			$html = is_home() ? '<h1 class="logo">' . $logo . '</h1>' : $logo;
    		} else {
    			$tag = is_home() ? 'h1' : 'div';
    
    			$html = '<' . esc_attr( $tag ) . ' class="beta site-title"><a href="' . esc_url( home_url( '/' ) ) . '" rel="home"><span style="color:#000">Store</span><span style="color:#ddd">Front</span></a></' . esc_attr( $tag ) . '>';
    
    			if ( '' !== get_bloginfo( 'description' ) ) {
    				$html .= '<p class="site-description">' . esc_html( get_bloginfo( 'description', 'display' ) ) . '</p>';
    			}
    		}
    
    		if ( ! $echo ) {
    			return $html;
    		}
    
    		echo $html;
    	}
    

    I added your example as an example so you can see where to edit 🙂

    James
    Designer @ Automattic

    Hi,

    It works thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page title in two colors’ is closed to new replies.