• Resolved Scott

    (@scottos)


    Hi, I’ve installed a child theme (Deli) that i’m heavily modifying. I’m experienced with php, html and css, but not so much with WordPress.

    Just wondering how I can move the code for the shopping cart (I basically want to move it where the search field is now in the storefront theme) and I wish to move the search field down below the navigation. Looking at header.php I can see an action;

    <?php
    			/**
    			 * @hooked storefront_skip_links - 0
    			 * @hooked storefront_social_icons - 10
    			 * @hooked storefront_site_branding - 20
    			 * @hooked storefront_secondary_navigation - 30
    			 * @hooked storefront_product_search - 40
    			 * @hooked storefront_primary_navigation - 50
    			 * @hooked storefront_header_cart - 60
    			 */
    			do_action( 'storefront_header' ); ?>

    Basically I want to drill down into that and re-arrange things. Any help on how to do that would be appreciated thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Good that you are already using a child theme.
    You need to track down all your theme code which is hooking ‘storefront_header’, there may be more than one, they will only be in your parent theme files because this hook is specific to your theme.
    Now that you have found the function you want to change, make a copy of it into your “functions.php” file in your child theme, give the function a new name. Rearrange the header layout to your tastes.
    Now hook your new function to ‘storefront_header’.
    Now comes the tricky part, your functions.php is loaded prior to activating the parent theme, so you must add a new function which will unhook their function, your new function needs to run AFTER the parent theme has been installed, a quick search here:
    https://adambrown.info/p/wp_hooks/hook
    found the most likely candidate: ‘after_setup_theme’

    Thread Starter Scott

    (@scottos)

    Brilliant, thanks for that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce Storefront – move cart out of nav bar and move search field’ is closed to new replies.