• Resolved zebracom

    (@zebracom)


    I want my handheld footer to display “my-account”, “home” and “cart” in that exact order. When I used some code snippets (found here: https://docs.woocommerce.com/document/customize-the-links-in-the-handheld-footer-bar/) to remove my search button and insert a home button, I was stuck with the “home” – “my-account” – “cart” order. So I thought about removing “my-account” too and reinserting it with the snipped I used to add “home”, but I have no idea how to edit said snippet to link to the “my-account” page. I’ve been looking for documentation of the used tags and the tags I need all day, but there is none to be found. What the hell is “jk_add_home_link” even and where do I find more stuff like this? I don’t even know what part of wordpress “jk_” is supposed to refer to.

    Anyway, I’d like to know how I can add other buttons besides “home”, alternatively, how I could replace the middle “search” button with “jk_home_link”, whatever that may be, and perhaps where the hell these tags are documented and where the base code that creates the handheld footer even is.

    
    add_filter( 'storefront_handheld_footer_bar_links', 'jk_remove_handheld_footer_links' );
    function jk_remove_handheld_footer_links( $links ) {
    	unset( $links['my-account'] );
    	unset( $links['search'] );
    
    	return $links;
    }
    
    add_filter( 'storefront_handheld_footer_bar_links', 'jk_add_home_link' );
    function jk_add_home_link( $links ) {
    	$new_links = array(
    		'home' => array(
    			'priority' => 10,
    			'callback' => 'jk_home_link',
    		),
    	);
    
    	$links = array_merge( $new_links, $links );
    
    	return $links;
    }
    
    function jk_home_link() {
    	echo '<a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Home' ) . '</a>';
    }
    
    • This topic was modified 7 years, 2 months ago by zebracom.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @zebracom,

    You were very close! Here’s how to do it:

    add_filter( 'storefront_handheld_footer_bar_links', 'jk_remove_handheld_footer_links' );
    function jk_remove_handheld_footer_links( $links ) {
    	unset( $links['my-account'] );
    	unset( $links['search'] );
    	unset( $links['cart'] );
    
    	return $links;
    }
    
    add_filter( 'storefront_handheld_footer_bar_links', 'jk_add_home_link' );
    function jk_add_home_link( $links ) {
    
    	$new_links = array(
    		'my-account' => array(
    			'priority' => 10,
    			'callback' => 'storefront_handheld_footer_bar_account_link',
    		),
    		'home' => array(
    			'priority' => 20,
    			'callback' => 'jk_home_link',
    		),
    		'cart'       => array(
    			'priority' => 30,
    			'callback' => 'storefront_handheld_footer_bar_cart_link',
    		),
    	);
    
    	$links = array_merge( $new_links, $links );
    
    	return $links;
    }
    
    function jk_home_link() {
    	echo '<a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Home' ) . '</a>';
    }

    I removed them all and then added them back in the custom order.

    Cheers,

    Hi @mikeyarce, I know this a little bit too late but do you know how to remove the navigation bar at the bottom of the handheld view? I tried to add this code to my functions.php but its still there

    add_action( 'init', 'jk_remove_storefront_handheld_footer_bar' );
    
    function jk_remove_storefront_handheld_footer_bar() {
      remove_action( 'storefront_footer', 'storefront_handheld_footer_bar', 999 );
    }
    • This reply was modified 6 years, 10 months ago by Bryan Tan.
    • This reply was modified 6 years, 10 months ago by Bryan Tan.

    i’d change my mobile menu too, removing the search button and replaced with “home” – but don’t like that “home” will send to homepage – instead should go to the shops startpage, but how that will be done?
    thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Editing handheld footer middle button and/or button order’ is closed to new replies.