Skip to content

Instantly share code, notes, and snippets.

@jmabbas
Created July 4, 2024 06:14
Show Gist options
  • Save jmabbas/3c21c79a3b087708761ed9272272fba6 to your computer and use it in GitHub Desktop.
Save jmabbas/3c21c79a3b087708761ed9272272fba6 to your computer and use it in GitHub Desktop.
Electro - Mobile header my account to custom link
function electro_handheld_header_links() {
$links = array(
'search' => array(
'priority' => 10,
'callback' => 'electro_handheld_header_search_link',
),
'cart' => array(
'priority' => 30,
'callback' => 'electro_handheld_footer_bar_cart_link',
)
);
if ( ! function_exists( 'wc_get_page_id' ) || wc_get_page_id( 'myaccount' ) === -1 ) {
unset( $links['my-account'] );
}
if ( ! function_exists( 'wc_get_page_id' ) || wc_get_page_id( 'cart' ) === -1 || electro_get_shop_catalog_mode() == true ) {
unset( $links['cart'] );
}
$links = apply_filters( 'electro_handheld_header_links', $links );
?>
<div class="handheld-header-links">
<ul class="columns-<?php echo count( $links ); ?>">
<li class="my-account">
<a href="https://www.google.co.in/"><i class="ec ec-user"></i></a>
</li>
<?php foreach ( $links as $key => $link ) : ?>
<li class="<?php echo esc_attr( $key ); ?>">
<?php
if ( $link['callback'] ) {
call_user_func( $link['callback'], $key, $link );
}
?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment