how to show wordpress site title and tagline?

I’m trying to put site title and tagline in child theme header. I searched about it and find these two different wordpress functions get_bloginfo() and bloginfo().

get_bloginfo() doesn’t showing the tagline, and bloginfo() showing both site title and tagline. Problem is that bloginfo() is removing the : and space between site title and description.

Read More
<title><?php bloginfo( 'name' ) . ' : '. bloginfo( 'description' ); ?></title>

Title: WebsiteThis is example website.

You can see there is no space between Website and This.

So is this possible that i show the site title and tagline with properly space and :?

Related posts

2 comments

  1. This will help you.

    <title> 
    <?php
    	$site_description = get_bloginfo( 'description', 'display' );
    	$site_name = get_bloginfo( 'name' );
        //for home page
    	if ( $site_description && ( is_home() || is_front_page() ) ):
    		echo $site_name;echo ' | '; echo  $site_description; 
    	endif;
    	// for other post pages
    	if (!( is_home() ) && ! is_404() ):
    	the_title(); echo ' | '; echo $site_name;
    	endif;
    	?>
    </title>
  2. Try this

    <title><?php echo get_bloginfo( 'name' ) . ' : '. get_bloginfo( 'description' ); ?></title>
    
    echo get_option('blogname'); // For Site Name
    echo get_option('blogdescription'); // For Tag line or description
    

Comments are closed.