Site logo

Archived topic

Logo

11 replies · Started by Sergei on November 14, 2017

Viewing posts 1–12 of 12

Hey. I have question about a logo. So, Customize->Layout->Primary Navigation i add a logo. But i can`t find function to make it non clickable. I use my website in 3 languages, my primary language is latvian. When i use russian or english language and click on logo, then my website starts again in latvian language.

Thanks

Hi there,

In that case we can try using the generate_inside_navigation: https://docs.generatepress.com/article/generate_inside_navigation/

So try this PHP snippet:

add_action( 'generate_inside_navigation','lh_add_navigation_logo' );
function lh_add_navigation_logo() {
    ?>
    <div class="site-logo sticky-logo navigation-logo">
       <img class="header-image" src="https://staduplacis.lv/wp-content/uploads/2017/10/Stadu-placis-LOGO-1.png" alt="Staduplacis.lv">
    </div>
    <?php
}

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know.

When i add this

add_action( 'generate_inside_navigation','lh_add_navigation_logo' );
function lh_add_navigation_logo() {
    ?>
    <div class="site-logo sticky-logo navigation-logo">
       <img src="https://staduplacis.lv/wp-content/uploads/2017/10/Stadu-placis-LOGO-1.png" alt="Staduplacis.lv" />
    </div>
    <?php
}

to my functions.php then i have 2 same logos, one is clickable, second is non clickable. Then i remove my logo from Primary Navigation and after that logo showing in header and big size.

The logo needs to be remove the primary navigation. We are basically rebuilding that feature.

Can you leave the code in so I can see the result and make adjustment?

Thanks.

Deleted logo from primary navigation. You can see now how it looks.

Try this CSS:

.main-navigation .navigation-logo {
    float: left;
    display: block;
    margin-left: -10px;
    -webkit-transition: height .3s ease;
    -o-transition: height .3s ease;
    transition: height .3s ease;
    opacity: 1;
}
.main-navigation .navigation-logo img {
    position: relative;
    vertical-align: middle;
    padding: 10px;
    display: block;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-transition: height .3s ease;
    -o-transition: height .3s ease;
    transition: height .3s ease;
}
.main-navigation .navigation-logo img {
    height: 60px;
}

Adding CSS: https://docs.generatepress.com/article/adding-css/

Its work, but not correct position on mobile device. Still better look when it was in primary navigation. Just need to remove link from logo.

Quick question before we continue. Are going to use sticky navigation?

Sticky navigation is disabled.

Hey sorry my apology.

Scratch all of the above. This snippet should work:

add_filter( 'generate_navigation_logo_output','lh_change_navigation_logo_output' );
function lh_change_navigation_logo_output( $output ) {
	return sprintf(
		'<div class="site-logo sticky-logo navigation-logo">
				<img class="header-image" src="%3$s" alt="%4$s" />
		</div>',
		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
		'http://staduplacis.lv/wp-content/uploads/2017/10/Stadu-placis-LOGO-1.png',
		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
	);
}

Thank you Leo. Working for me, problem resolved.

No problem.

Thanks for the question :)

This archived topic is closed to new replies.