• Dear…

    I’ve been try to add snippet to change the custom order of handheld menu, but when the search callback i’ve some problem.. This is the code :

    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(
    		'home' => array(
    			'priority' => 20,
    			'callback' => 'jk_home_link',
    		),
    		'search' => array(
    			'priority' => 30,
    			'callback' => 'storefront_handheld_footer_bar_search_link',
    		),
    		'my-account' => array(
    			'priority' => 40,
    			'callback' => 'storefront_handheld_footer_bar_account_link',
    		),
    	);
    
    	$links = array_merge( $new_links, $links );
    
    	return $links;
    }
    
    function jk_home_link() {
    	echo '<a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Home' ) . '</a>';
    }

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

    Where did you get that code from, and what are you trying to do with it exactly?

    Thread Starter griyaarafah

    (@griyaarafah)

    hi @senff

    I’m just trying to modify the code from this

    i think just work,, but it failed anyway for the search function.. please help me

    • This reply was modified 5 years, 10 months ago by griyaarafah.

    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(
    ‘home’ => array(
    ‘priority’ => 20,
    ‘callback’ => ‘jk_home_link’,
    ),
    ‘search’ => array(
    ‘priority’ => 30,
    ‘callback’ => ‘storefront_handheld_footer_bar_search_link’,
    ),
    ‘my-account’ => array(
    ‘priority’ => 40,
    ‘callback’ => ‘storefront_handheld_footer_bar_account_link’,
    ),
    );

    $links = array_merge( $new_links, $links );

    return $links;
    }

    function jk_home_link() {
    echo ‘‘ . __( ‘Home’ ) . ‘‘;
    }

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Handheld menu Search doesn’t work’ is closed to new replies.