Skip to content

Instantly share code, notes, and snippets.

@farookibrahim
farookibrahim / functions.php
Created December 8, 2017 07:32
Electro - Add recently viewed products before footer
/**
* Track product views.
*/
if( ! function_exists( 'electro_wc_track_product_view' ) ) {
function electro_wc_track_product_view() {
if ( ! is_singular( 'product' ) ) {
return;
}
global $post;
@ibndawood
ibndawood / form.html
Created August 17, 2018 14:00
Electro v2 - Mailchimp form newsletter
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="https://protools.us17.list-manage.com/subscribe/post?u=d255223a3b89ccd2f6a7526a5&amp;id=b8beeacab6" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll" class="input-group">
<input type="email" value="" name="EMAIL" class="email form-control" id="mce-EMAIL" placeholder="Tu email." required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_d255223a3b89ccd2f6a7526a5_b8beeacab6" tabindex="-1" value=""></div>
<span class="input-group-btn">
<button class="btn btn-secondary" id="mc-embedded-subscribe" type="submit">Subscribe</button>
@yousufansa
yousufansa / functions.php
Created September 12, 2018 14:56
WooCommerce Add Custom Sorting 'rand' in Shop Page
add_filter( 'woocommerce_default_catalog_orderby_options', 'ec_child_woocommerce_custom_catalog_orderby_options' );
function ec_child_woocommerce_custom_catalog_orderby_options ( $sorting ) {
$sorting['rand'] = esc_html__( 'Random', 'electro-child' );
return $sorting;
}
@farookibrahim
farookibrahim / functions.php
Created October 10, 2018 16:09
Electro Remove Categories in Loop and Single
function el_child_remove_product_category_info() {
remove_action( 'woocommerce_single_product_summary', 'electro_template_loop_categories', 1 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'electro_template_loop_categories', 20 );
remove_action( 'woocommerce_shop_loop_item_title', 'electro_template_loop_categories', 50 );
remove_action( 'electro_product_carousel_alt_content', 'electro_template_loop_categories', 30 );
remove_action( 'electro_product_card_view_body', 'electro_template_loop_categories', 10 );
}
add_action( 'init', 'el_child_remove_product_category_info', 20 );
@anastransvelo
anastransvelo / style.css
Last active March 3, 2021 07:20
electro news letter for mobile view
@media (max-width: 991.98px) {
.site-footer .footer-newsletter,
.desktop-footer .footer-newsletter .footer-newsletter-inner,
.footer-v2 .desktop-footer {
display: block;
}
.site-footer .footer-newsletter {
padding: 30px 15px;
}
@farookibrahim
farookibrahim / functions.php
Last active March 7, 2021 10:17
Electro - Header compare/wishlist tooltip text change
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" <?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() ); ?>">
@yousufansa
yousufansa / functions.php
Created November 19, 2018 06:38
Electro - Brands carousel Items to show
if ( ! function_exists( 'electro_child_footer_bc_carousel_args' ) ) {
function electro_child_footer_bc_carousel_args( $carousel_args ) {
$carousel_args['items'] = 4;
$carousel_args['responsive']['1200'] = 4;
return $carousel_args;
}
}
add_filter( 'ec_footer_bc_carousel_args', 'electro_child_footer_bc_carousel_args' );
@anastransvelo
anastransvelo / style.css
Created December 12, 2018 09:57
electro custom layout change for cart page
.woocommerce-cart .entry-content > .woocommerce {
display: flex;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
.woocommerce-cart .entry-content > .woocommerce .woocommerce-cart-form,
.woocommerce-cart .entry-content > .woocommerce .woocommerce-notices-wrapper,
.woocommerce-cart .entry-content > .woocommerce .cart-collaterals {
@ibndawood
ibndawood / functions.php
Created January 30, 2019 08:37
Electro v2 - Show brand name in product loop
add_action( 'woocommerce_shop_loop_item_title', 'ec_template_loop_product_brand', 41 );
function ec_template_loop_product_brand() {
global $product;
$product_id = electro_wc_get_product_id( $product );
$brands_tax = electro_get_brands_taxonomy();
$terms = get_the_terms( $product_id, $brands_tax );
$brand_name = '';
@yousufansa
yousufansa / functions.php
Created April 15, 2019 05:42
WC - Add SKU In WooCommerce Product Search
/**
* Join posts and postmeta tables
*
* @param string $join
* @param WP_Query $query
* @return string
*/
if( ! function_exists( 'wc_custom_product_search_join' ) ) {
function wc_custom_product_search_join( $join, $query ) {
if ( ! $query->is_main_query() || is_admin() || ! is_search() || ! is_woocommerce() ) {