Skip to content

Instantly share code, notes, and snippets.

View yousufansa's full-sized avatar

Yusuf Ansari yousufansa

View GitHub Profile
@yousufansa
yousufansa / style.css
Created November 23, 2020 12:45
Front - Display Products in Two Columns on Mobile
@media (max-width: 767.98px) {
.products[data-view=grid] ul.products > .product {
flex: 0 0 50%;
max-width: 50%;
}
}
@yousufansa
yousufansa / style.css
Created November 23, 2020 10:11
Electro - Hide Breadcrumb from Single Product Page
.single-product .woocommerce-breadcrumb {
display: none;
}
.single-product .woocommerce-breadcrumb + .site-content-inner {
margin-top: 1.786em;
}
@yousufansa
yousufansa / functions.php
Created November 20, 2020 09:26
Electro - Display Product SKU on Cart
if( ! function_exists( 'el_child_woocommerce_get_item_data' ) ) {
function el_child_woocommerce_get_item_data( $other_data, $cart_item ) {
$_product = $cart_item['data'];
$product_sku = $_product->get_sku();
$other_data[] = array(
'name' => __( 'SKU', 'electro' ),
'value' => $product_sku,
'display' => ''
);
return $other_data;
@yousufansa
yousufansa / style.css
Created November 20, 2020 07:03
Bookworm - Display Header v1 Top bar on Mobile
@media (max-width: 767.98px) {
.site-header__v1 .topbar {
position: static;
border-bottom: 1px solid #eae8e4 !important;
}
.site-header__v1 .topbar__nav {
display: flex;
}
@yousufansa
yousufansa / functions.php
Created November 19, 2020 06:41
Cartzilla - Display Product Category Description & Image on Product Category page before products loop
if( ! function_exists( 'cz_child_display_product_category_description_with_image' ) ) {
function cz_child_display_product_category_description_with_image() {
if ( is_product_category() ) {
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_image_src( $thumbnail_id );
$term_description = term_description();
if( ! empty( $image ) || ! empty( $term_description ) ) {
?><div class="media align-items-center mb-4"><?php
@yousufansa
yousufansa / functions.php
Created November 19, 2020 05:39
Front - Change Post Archive Title
if( ! function_exists( 'front_child_get_the_archive_title' ) ) {
function front_child_get_the_archive_title() {
if ( is_category() ) {
$title = esc_html__( 'Category Archives - ', 'front' ) . '<span class="page-description text-primary font-weight-semi-bold">' . single_term_title( '', false ) . '</span>';
} elseif ( is_tag() ) {
$title = esc_html__( 'Tag Archives - ', 'front' ) . '<span class="page-description text-primary font-weight-semi-bold">' . single_term_title( '', false ) . '</span>';
} elseif ( is_author() ) {
$title = esc_html__( 'Author Archives - ', 'front' ) . '<span class="page-description text-primary font-weight-semi-bold">' . get_the_author_meta( 'display_name' ) . '</span>';
} elseif ( is_year() ) {
$title = esc_html__( 'Yearly Archives - ', 'front' ) . '<span class="page-description text-primary font-weight-semi-bold">' . get_the_date( _x( 'Y', 'yearly archives date format', 'front' ) ) . '</span>';
@yousufansa
yousufansa / functions.php
Created November 18, 2020 14:32
Techmarket - Star Rating Style Issue Fix
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger:before {
font-family: 'FontAwesome';
}
body.kc-css-system .star-rating span {
font-size: inherit;
}
body.kc-css-system .star-rating span:before {
letter-spacing: .313em;
@yousufansa
yousufansa / functions.php
Created November 18, 2020 06:16
Front - Tabs Block Tab Change on Hover
if( ! function_exists( 'front_child_fgb_tabs_block_tab_change_on_hover_script' ) ) {
function front_child_fgb_tabs_block_tab_change_on_hover_script() {
ob_start(); ?>
(function ($) {
"use strict";
$(document).ready(function () {
$(".fgb-tabs-block .nav-link").hover(function(){ $(this).tab("show"); });
});
})(jQuery);
<?php
@yousufansa
yousufansa / functions.php
Created November 17, 2020 11:57
Bookworm - Grocery Header Disable Pop-up Login/Register Form
<?php
/**
* Template for displaying the "Grocery header
*
* @link https://codex.wordpress.org/Template_Hierarchy
*/
?>
<header id="masthead" role="banner" class="bg-light box-shadow-sm fixed-top side-header-fixed-top <?php echo cartzilla_header_is_sticky() ? 'navbar-sticky' : ''; ?>">
<div class="<?php cartzilla_navbar_class( 'navbar-light' ); ?>">
<div class="container-fluid">
@yousufansa
yousufansa / functions.php
Created November 17, 2020 11:19
Bookworm - Fix Cart Overlapping Offcanvas Menu Issue
if ( ! function_exists( 'bookworm_cart_link_fragment' ) ) {
function bookworm_cart_link_fragment( $fragments ) {
global $woocommerce;
ob_start();
bookworm_cart_page_header();
$fragments['.page__header--cart'] = ob_get_clean();
ob_start();
bookworm_cart_link_count();