• Resolved shungshan

    (@shungshan)


    I would like to show both the site title and the logo side by side.
    I messed around with the files and found this piece of code and I would like to modify it to show the title and logo.

    if ( ! function_exists( 'storefront_site_title_or_logo' ) ) {
    	/**
    	 * Display the site title or logo
    	 *
    	 * @since 2.1.0
    	 * @param bool $echo Echo the string or return it.
    	 * @return string
    	 */
    	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">' . esc_html( get_bloginfo( 'name' ) ) . '</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; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    	}
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey there,

    Instead of using PHP, I could also recommend doing it through CSS. Here’s the code I used in the process:

    
    .site-header .custom-logo-link {
        display: flex;
        align-items: center;
    }
    
    .site-header .custom-logo-link::after {
        content: "Site title";
        padding-left: 20px;
    }
    

    I hope this helps!

    Thread Starter shungshan

    (@shungshan)

    Hello @robertghetau,

    Sorry for the long time until the response. How would I go about showing the site description?

    Thanks.

    • This reply was modified 3 years, 10 months ago by shungshan.

    Hi @shungshan,

    How would I go about showing the site description?

    Could you please let us know a bit more about what you mean? Are you referring to the WordPress Tagline, as explained here: https://wpdatatables.com/wordpress-tagline/?

    Hi again,

    We haven’t heard back from you for a while, so I’m going to mark this post as resolved. If you have any further questions or need additional help with the Storefront theme, please start a new thread and we’ll be able to help you out there. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show Logo and Title’ is closed to new replies.