• Resolved MooK

    (@kubelyan)


    Hi, Great theme. So far enjoying it a lot. Easy to customize.
    But I need your advice. Whats the best way to replace site title by logo?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author felixdorner

    (@felixdorner)

    As far as I know the newest WordPress version allows you to upload and use a site logo. Search for the setting in the customizer. Before, this was supported by the Jetpack plugin. Both ways should be compatible to my theme.

    Thread Starter MooK

    (@kubelyan)

    I can see the only option adding Site Icon
    <<The Site Icon is used as a browser and app icon for your site. Icons must be square, and at least 512 pixels wide and tall.>>
    I am asking about site Logo…
    There is no options for it. And I’d like to know your oppinion whats the best way to have a logo instead of site title.

    Thanks

    Thread Starter MooK

    (@kubelyan)

    Just want to share:
    I started to look at it and realized that in functions.php only jetpack code and wordpress one is missing:
    I relapsed this one:
    ` /*
    * Enable support for Site Logo
    * See https://jetpack.me/support/site-logo/
    */
    add_theme_support( ‘site-logo’ );`

    By original wordpress one:

    /**
    * Create Logo Setting and Upload Control
    */
    function your_theme_new_customizer_settings($wp_customize) {
    // add a setting for the site logo
    $wp_customize->add_setting('your_theme_logo');
    // Add a control to upload the logo
    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'your_theme_logo',
    array(
    'label' => 'Upload Logo',
    'section' => 'title_tagline',
    'settings' => 'your_theme_logo',
    ) ) );
    }
    add_action('customize_register', 'your_theme_new_customizer_settings');

    Now I got the upload logo option in Customizer.

    ————————————–

    in header.php this part:

    <?php if ( ( function_exists( 'jetpack_the_site_logo' ) && jetpack_has_site_logo() ) ) :
    					jetpack_the_site_logo();
    				else : ?>
    					<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    				<?php endif; ?>

    Needs to be replaced by:

    <?php
    // check to see if the logo exists and add it to the page
    if ( get_theme_mod( 'your_theme_logo' ) ) : ?>
    
    <img src="<?php echo get_theme_mod( 'your_theme_logo' ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" >
    
    <?php // add a fallback if the logo doesn't exist
    else : ?>
    
    <h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
    
    <?php endif; ?>

    ——————————————————-

    then css could be customized:

    .site-branding img {
        display: block;
        max-height: 75px;
        width: auto;
    }

    ———————————————————–

    Those changes made it works for me.

    Theme Author felixdorner

    (@felixdorner)

    Sounds great. I will implement this in a future release. Thanks for your effort to dive into this topic. Otherwise you can also use the Jetpack Plugin for adding a site logo.

    Thread Starter MooK

    (@kubelyan)

    actually, I corrected a little bit the site-branding php code on the header.php

    <div class="site-branding">
    			<?php //show title or Header image
    			if ( get_theme_mod( 'your_theme_logo' ) ) {
    				echo '<a href="'. home_url() .'"><img alt="'. esc_attr( get_bloginfo( 'name' ) ) .'" title="'. esc_attr( get_bloginfo( 'name' ) ) .'" class="header-image" src="' . esc_url( get_theme_mod( 'your_theme_logo' )  ) . '" /></a>';
    			} else { ?>
    				<h1 class="site-title"><a title="<?php bloginfo( 'name' ); ?>" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    
     	         <?php } ?>
    
    			</div>
    Theme Author felixdorner

    (@felixdorner)

    Finally, I implemented the native solution of WordPress to add a logo.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Site Logo’ is closed to new replies.