Site logo

Archived topic

generate_after_header_content spacing and layout

13 replies · Started by Richard on March 16, 2022

Viewing posts 1–14 of 14

I’m trying to add elements to the generate_after_header_content and can’t seem to figure out how to keep the text in those blocks from wrapping to the next line, especially when there is soooo much room in the search bar. I know it’s got flex in there but I’m not familiar with that.

Hi Richard,

To have a better understanding of the issue, may you kindly add the Element and send a screenshot of the issue with a description of how you would like it to look like?

Hope to hear from you soon. :)

I see. Thank you for including a screen recording.

To confirm, are you wanting something like this?: https://share.getcloudapp.com/2NuzBpYB

If so, here is a CSS code you may try:

.woo-search {
    flex-grow: 4;
}

.header-widget {
    flex-grow: 1;
}

.wp-block-columns .wp-block-column {
    text-align:right;
}

Here is an article with regards to adding CSS: https://docs.generatepress.com/article/adding-css/#additional-css

Adding this through additional CSS should work.

Hope this helps! Kindly let us know if you prefer something else. :)

That got us halfway there. It appears in that location but doesn't have the hover and display of mini cart as the "normal" one does. (also, would like to remove it from the normal location once functioning properly)

Try this PHP snippet:

add_action('generate_after_header_content','generate_woo_cart'); 

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
	);
}

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

There are now three carts and the mini cart visibility seems to have gotten worse.

1.Remove the hook with Fernando's code.
2.Disable the cart in customizer > layout > Woocommerce

OK, thank you. It's no longer aligned with the icon, though. How can I fix that? I tried `.wc-mini-cart {
right: 100px;}` but it didn't seem to work

I think it's working now. Maybe it was cached. We can close this now. I will start a new thread if I have further questions.

Thanks!

Glad to hear that :)

This archived topic is closed to new replies.