Skip to content

Instantly share code, notes, and snippets.

@akther80
Created May 25, 2019 05:47
Show Gist options
  • Save akther80/10a9494231499c9a0dbe2a1a9ec2aef3 to your computer and use it in GitHub Desktop.
Save akther80/10a9494231499c9a0dbe2a1a9ec2aef3 to your computer and use it in GitHub Desktop.
Electro v2 - Add wishlist and Compare text below header icon
if ( ! function_exists( 'electro_compare_header_icon' ) ) {
/**
* @since 2.0
*/
function electro_compare_header_icon() {
if( function_exists( 'electro_get_compare_page_url' ) ) :
global $yith_woocompare;
$header_tooltip_placement = apply_filters( 'electro_header_tooltip_placement', 'bottom' );
?><div class="header-icon header-icon-wishlist" <?php if ( $header_tooltip_placement ) : ?>data-toggle="tooltip" data-placement="<?php echo esc_attr( $header_tooltip_placement ); ?>" data-title="<?php echo esc_attr( esc_html__( 'Compare', 'electro' ) ); ?>"<?php endif; ?>>
<a href="<?php echo esc_attr( electro_get_compare_page_url() ); ?>">
<i class="<?php echo esc_attr( apply_filters( 'electro_compare_icon', 'ec ec-compare' ) ); ?>"></i>
<span class="header-icon-text"><?php echo esc_html('Wishlist', 'electro'); ?>
<?php if ( apply_filters( 'electro_show_compare_count', false ) ) : ?>
<span class="navbar-compare-count count header-icon-counter" class="value"><?php echo count( $yith_woocompare->obj->products_list ); ?></span>
<?php endif; ?>
</a>
</div><?php
endif;
}
}
if ( ! function_exists( 'electro_wishlist_header_icon' ) ) {
/**
* @since 2.0
*/
function electro_wishlist_header_icon() {
if ( function_exists( 'electro_get_wishlist_url' ) ) :
$header_tooltip_placement = apply_filters( 'electro_header_tooltip_placement', 'bottom' );
?><div class="header-icon header-icon-compare" <?php if ( $header_tooltip_placement ): ?>data-toggle="tooltip" data-placement="<?php echo esc_attr( $header_tooltip_placement ); ?>" data-title="<?php echo esc_attr( esc_html__( 'Wishlist', 'electro' ) ); ?>"<?php endif; ?>>
<a href="<?php echo esc_attr( electro_get_wishlist_url() ); ?>">
<i class="<?php echo esc_attr( apply_filters( 'electro_wishlist_icon', 'ec ec-favorites' ) ); ?>"></i>
<span class="header-icon-text"><?php echo esc_html('Compare', 'electro'); ?>
<?php if ( apply_filters( 'electro_show_wishlist_count', false ) ) : ?>
<span class="navbar-wishlist-count count header-icon-counter" class="value"><?php echo yith_wcwl_count_products(); ?></span>
<?php endif; ?>
</a>
</div><?php
endif;
}
}
.header-icon-wishlist a,
.header-icon-compare a {
display: flex;
flex-direction: column;
align-items: center;
}
.header-icon-wishlist span,
.header-icon-compare span {
font-size: 13px;
line-height: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment