Created
May 2, 2018 10:23
-
-
Save ibndawood/793554a65287336b480bb957241efd6d to your computer and use it in GitHub Desktop.
Electro v2 - Add compare and wishlist to mobile header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'electro_handheld_header_links', 'ec_child_add_wishlist_compare', 10 ); | |
function ec_child_add_wishlist_compare( $links ) { | |
$links['wishlist'] = array( | |
'priority' => 40, | |
'callback' => 'ec_child_wishlist_header_link' | |
); | |
$links['compare'] = array( | |
'priority' => 40, | |
'callback' => 'ec_child_compare_header_link' | |
); | |
return $links; | |
} | |
function ec_child_wishlist_header_link() { | |
if ( function_exists( 'yith_wcwl_count_products' ) && function_exists( 'electro_get_wishlist_url' ) ) : ?> | |
<a href="<?php echo esc_attr( electro_get_wishlist_url() ); ?>" class="nav-link"> | |
<i class="<?php echo esc_attr( apply_filters( 'electro_wishlist_icon', 'ec ec-favorites' ) ); ?>"></i> | |
<?php if ( apply_filters( 'electro_show_wishlist_count', false ) ) : ?> | |
<span class="navbar-wishlist-count count" class="value"><?php echo yith_wcwl_count_products(); ?></span> | |
<?php endif; ?> | |
</a> | |
<?php endif; | |
} | |
function ec_child_compare_header_link() { | |
global $yith_woocompare; | |
if ( function_exists( 'electro_get_compare_page_url') ) : ?> | |
<a href="<?php echo esc_attr( electro_get_compare_page_url() ); ?>" class="nav-link"> | |
<i class="<?php echo esc_attr( apply_filters( 'electro_compare_icon', 'ec ec-compare' ) ); ?>"></i> | |
<?php if ( apply_filters( 'electro_show_compare_count', false ) ) : ?> | |
<span class="navbar-compare-count count" class="value"><?php echo count( $yith_woocompare->obj->products_list ); ?></span> | |
<?php endif; ?> | |
</a><?php endif; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.handheld-header-v2 .handheld-header-links>ul a.nav-link { | |
padding: 0; | |
text-indent: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment