Skip to content

Instantly share code, notes, and snippets.

@akther80
akther80 / functions.php
Created November 7, 2018 06:08
Electro - Footer After Custom Text
if ( ! function_exists( 'electro_child_footer_custom_content_2' ) ) {
function electro_child_footer_custom_content_2() {
if( is_front_page() ) { ?>
<div class="footer-after-custom-text">
<div class="container">
Your Text Here - 2
</div>
</div>
<?php }
}
@akther80
akther80 / functions.php
Created November 9, 2018 06:00
Electro v2 - Remove compare icon
add_action( 'init', 'ec_child_remove_compare_button_in_loop' );
function ec_child_remove_compare_button_in_loop() {
remove_action( 'electro_loop_action_buttons', 'electro_add_to_compare_link', 20 );
}
@akther80
akther80 / functions.php
Created November 15, 2018 14:44
Techmarket - Clickable Navbar Primary parent menu
add_action( 'wp_enqueue_scripts', 'tm_child_enqueue_custom_js', 30 );
function tm_child_enqueue_custom_js() {
ob_start(); ?>
jQuery(document).ready(function($){
if (jQuery(window).width() >= 1025){
$(".navbar-primary .dropdown-toggle").click(function () {
var addressValue = $(this).attr("href");
location.href=addressValue;
@akther80
akther80 / functions.php
Created November 19, 2018 14:49
Electro v2 Remove jumbotron in search result
if( ! function_exists( 'electro_shop_archive_jumbotron' ) ) {
function electro_shop_archive_jumbotron() {
$static_block_id = '';
$brands_taxonomy = electro_get_brands_taxonomy();
if( is_shop() && !is_search() ) {
$static_block_id = apply_filters( 'electro_shop_jumbotron_id', '' );
} else if ( is_product_category() || is_tax( $brands_taxonomy ) ) {
$term = get_queried_object();
$term_id = $term->term_id;
@akther80
akther80 / functions.php
Created December 5, 2018 05:46
Electro v2 - Move Archive Description below Product
add_action( 'init', 'ec_child_rearrange_archive_description_below_product' );
function ec_child_rearrange_archive_description_below_product() {
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 100 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_product_archive_description', 100 );
}
@akther80
akther80 / functions.php
Created December 6, 2018 05:51
Electro v2 - Add wishlist to mobile header
add_filter( 'electro_handheld_header_links', 'ec_child_add_wishlist', 10 );
function ec_child_add_wishlist( $links ) {
$links['wishlist'] = array(
'priority' => 40,
'callback' => 'ec_child_wishlist_header_link'
);
return $links;
}
@akther80
akther80 / functions.php
Created December 11, 2018 14:19
WooCommerce - Add a script tag in body tag
function tm_child_header_script () {?>
<script id = "mcjs">! function (c, h, i, m, p) {m = c.createElement (h), p = c.getElementsByTagName (h) [0], m.async = 1, m .src = i, p.parentNode.insertBefore (m, p)} (document, "script", "https://chimpstatic.com/mcjs-connected/js/users/0f3b24053a8c0b469280bc713/ff31f5cbe2b678ce98a565e10.js"); </ script>
<? php}
add_action ('wp_head', 'tm_child_header_script', 10);
@akther80
akther80 / functions.php
Created December 19, 2018 05:43
Tokoo- Display percentage of discount instead of sale badge
add_action( 'init', 'tk_child_display_discount_percentage_instead_sale_badge' );
function tk_child_display_discount_percentage_instead_sale_badge() {
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'tokoo_get_sale_flash', 10 );
}
function tokoo_get_sale_flash() {
global $product;
@akther80
akther80 / functions.php
Created January 7, 2019 05:39
Techmarket - Clickable Primary navigation parent menu
add_action( 'wp_enqueue_scripts', 'tm_child_enqueue_custom_js', 30 );
function tm_child_enqueue_custom_js() {
ob_start(); ?>
jQuery(document).ready(function($){
if (jQuery(window).width() >= 1025){
$(".primary-navigation .dropdown-toggle").click(function () {
var addressValue = $(this).attr("href");
location.href=addressValue;
@akther80
akther80 / functions.php
Last active January 9, 2019 14:49
Tokoo- Display percentage of discount instead of sale badge in Single Product page
add_action( 'init', 'tk_child_display_discount_percentage_in_single_product_page' );
function tk_child_display_discount_percentage_in_single_product_page() {
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );
add_action( 'woocommerce_before_single_product_summary', 'tokoo_get_sale_flash', 21 );
}
function tokoo_get_sale_flash() {
global $product;