Skip to content

Instantly share code, notes, and snippets.

View mbilalsiddique1's full-sized avatar
🏠
Working from home

Muhammad Bilal mbilalsiddique1

🏠
Working from home
View GitHub Profile
@mbilalsiddique1
mbilalsiddique1 / sortFn.js
Created October 9, 2024 10:12
Flexible Array and String Sort Utility
function sort(input, ...sortArgs) {
// Handles both null and undefined
if (input == null) return [];
if (typeof input === 'string') {
return input.split(',').sort(...sortArgs);
}
if (Array.isArray(input)) {
return input.slice().sort(...sortArgs);
@mbilalsiddique1
mbilalsiddique1 / woocommerce-custom-product-tabs.php
Last active December 25, 2022 09:48
WooCommerce Custom Product Tabs
<?php
add_filter( 'woocommerce_product_tabs', 'wc_add_custom_tabs' );
function wc_add_custom_tabs($tabs) {
// Add the custom tab
$tabs['specifiction_tab'] = array(
'title' => __('Specification', 'dcpd'),
'priority' => 50,
'callback' => 'wc_custom_tabs_cb'
@mbilalsiddique1
mbilalsiddique1 / woocommerce-catalog-mode.php
Last active December 22, 2022 12:56
WooCommerce - Enable Catalouge Mode
<?php
/*
Plugin Name: WooCommerce Catalog Mode
Plugin URI: https://gist.github.com/mbilalsiddique1/52c0d13cd5c78f8f00f0c024b521f761
Description: This plugin enables catalog mode for WooCommerce and removes the shopping functionality.
Version: 1.0.0
Author: Muhammad Bilal
Author URI: https://github.com/mbilalsiddique1
License: GPLv2 or later
Text Domain: woocommerce-catalog-mode