[Resolved] generate_after_header_content spacing and layout

Home Forums Support [Resolved] generate_after_header_content spacing and layout

Home Forums Support generate_after_header_content spacing and layout

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2157309
    Richard

    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.

    #2157321
    Fernando
    Customer Support

    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. 🙂

    #2161398
    Richard

    Look how much room there is for the search bar and how tight it is for the two elements after the search. I need to give those elements room to breathe and now wrap to the next line
    https://watch.screencastify.com/v/LjYvFIKjnF3p8pSbR1gG

    #2161466
    Fernando
    Customer Support

    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. 🙂

    #2162860
    Richard

    Thank you! How can I get the cart up into the generate_after_header_content before or after Login? https://watch.screencastify.com/v/2eLGlvnRdNzS4QiDjLI4

    #2162886
    Fernando
    Customer Support

    You can hook this PHP code:

    <?php echo generatepress_wc_cart_link(); ?>

    Example: https://share.getcloudapp.com/Z4u7LjZZ

    Hope this helps! Kindly let us know how it goes. 🙂

    #2163770
    Richard

    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)

    #2163796
    Ying
    Staff
    Customer Support

    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/

    #2163808
    Richard

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

    #2163815
    Ying
    Staff
    Customer Support

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

    #2163857
    Richard

    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

    #2163888
    Ying
    Staff
    Customer Support

    This is what I see, not sure what do you mean by “it’s no longer aligned with the icon?”
    https://www.screencast.com/t/0IrtHK8B8Dku

    Can you describe it more specifically?

    #2163959
    Richard

    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!

    #2164009
    Ying
    Staff
    Customer Support

    Glad to hear that 🙂

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.