Skip to content

Instantly share code, notes, and snippets.

@zahedkamal87
zahedkamal87 / gist:8f76ea12c1470109f56b4b0afd3a49c7
Created July 11, 2017 09:55 — forked from jineeshjohn/gist:2044414
Dynamic html table rows and column creation with jQuery
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<style>
table{
width:500px;
height:500px;
}
table td{
padding:10px;
margin:10px;
border:1px solid #ccc;
@zahedkamal87
zahedkamal87 / sass-mixin-font-face.scss
Created August 16, 2017 21:24 — forked from oddscenes/sass-mixin-font-face.scss
Sass mixin for including fonts for font-face
@mixin font-face($font-name, $file-name, $weight: normal, $style: normal) {
@font-face {
font-family: quote($font-name);
src: url($file-name + '.eot');
src: url($file-name + '.eot?#iefix') format('embedded-opentype'),
url($file-name + '.woff') format('woff'),
url($file-name + '.ttf') format('truetype'),
url($file-name + '.svg##{$font-name}') format('svg');
font-weight: $weight;
font-style: $style;
@zahedkamal87
zahedkamal87 / sass-margin-padding.scss
Created August 16, 2017 21:25 — forked from oddscenes/sass-margin-padding.scss
Sass mixin for quickly adding padding and margins
//Padding mixin
@mixin padding($top, $right, $bottom, $left) {
padding-top: $top;
padding-right: $right;
padding-bottom: $bottom;
padding-left: $left;
}
//Margin mixin
@mixin margin($top, $right, $bottom, $left) {
margin-top: $top;
@zahedkamal87
zahedkamal87 / jquery-device-detect
Created November 29, 2017 16:54 — forked from dubrod/jquery-device-detect
jQuery Device Detect via User Agent
//touch/mobile detection
if (
navigator.userAgent.match(/Phone/i) ||
navigator.userAgent.match(/DROID/i) ||
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/) ||
navigator.userAgent.match(/Windows Phone/i) ||
@zahedkamal87
zahedkamal87 / bootstrap-4-sass-mixins-cheat-sheet.scss
Created February 25, 2018 09:02 — forked from anschaef/bootstrap-4-sass-mixins-cheat-sheet.scss
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// @author http://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
@zahedkamal87
zahedkamal87 / woocommerce-optimize-scripts.php
Created March 3, 2018 12:27 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@zahedkamal87
zahedkamal87 / functions.php
Created March 3, 2018 19:17 — forked from corsonr/functions.php
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
@zahedkamal87
zahedkamal87 / gist:5ec7473cd1f7c68189968bae1765c51c
Created March 6, 2018 21:19 — forked from mikejolley/gist:2044101
WooCommerce - Show number of items in cart and total
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@zahedkamal87
zahedkamal87 / functions.php
Created March 11, 2018 12:43 — forked from cagartner/functions.php
Cheatsheet - WooCommerce Customization in functions.php
//Add a stylesheet after default style.css
wp_enqueue_style( 'my-css', get_template_directory_uri() . 'my-css.css', array('themename-style'));
//WooCommerce - Sort products by SKU
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_catalog_orderby');
function custom_woocommerce_catalog_orderby( $args ) {
$args['meta_key'] = '_sku';
$args['orderby'] = 'meta_value';
$args['order'] = 'asc';
return $args;
@zahedkamal87
zahedkamal87 / LoremIpsumGenerator.php
Created March 24, 2018 21:04 — forked from lavoiesl/LoremIpsumGenerator.php
Generate Lorem Ipsum using loripsum.net API
<?php
/**
* Generate rich Lorem Ipsum with various options
* Uses the API of http://loripsum.net/
* Features a generator made especially for Wordpress
*
* @link http://blog.lavoie.sl/2012/12/generate-lorem-ipsum-using-loripsumnet.html
*/
class LoremIpsumGenerator