Site logo

Archived topic

Stop Logo shrinking

10 replies · Started by Stephen on February 22, 2022

Viewing posts 1–11 of 11

Hi, in header I have my nav menu floating to the right and the logo on the left.

As the screen size narrows through desktop & tablet sizes the logo does gradually shrink down in size.

How can I make it stay the same size ?

Also how can I set padding to the side of the logo ?

Thank you

Try this CSS:

.site-logo {
    flex-shrink: 0;
    padding: 0 20px 0 20px;
}

The padding value presents top/right/bottom/left.

thats very useful thank you

is it possible to have a below header section I can put woo cart and breadcrumbs in ?

For breadcrumbs, are you going to add a shortcode? Let me know!

Woo cart is added to primary navigation by default, if you want to add it to another position, PHP code is required:

add_action('wp',function(){ 
   add_action('generate_after_header','generate_woo_cart'); // adds cart after header
});

function generate_woo_cart(){
	if ( ! class_exists( 'WooCommerce' ) ) {
	    return;
	}

	if ( ! isset( WC()->cart ) ) {
		return;
	}

	$has_items = false;

	if ( ! WC()->cart->is_empty() ) {
		$has_items = 'has-items';
	}

	printf(
		'<span class="menu-bar-item wc-menu-item %2$s %3$s">
			%1$s
		</span>',
		generatepress_wc_cart_link(),
		is_cart() ? 'current-menu-item' : '',
		$has_items
	);
}

hi, not so easy then.

I put the PHP code above in the "code snippet" plugin and it says there was a fatal error.

How do I add PHP code please

Can you give it another try? I just updated the code.

Code snippet plugin is the right way to add PHP :)

thats great thanks.

I'll fiddle around a bit more to see if I can get something I like. 👍

thanks

You are welcome :)

This archived topic is closed to new replies.