Skip to content

Instantly share code, notes, and snippets.

@mhmanik
mhmanik / asset_dynamic_ver.php
Created May 21, 2019 10:41 — forked from kowsar89/asset_dynamic_ver.php
Apply dynamic version number in all css and js files
<?php
// Apply dynamic version number in all css and js files
add_filter( 'script_loader_src', 'k_script_dynamic_ver_num', 150 );
add_filter( 'style_loader_src', 'k_script_dynamic_ver_num', 150);
function k_script_dynamic_ver_num( $src ){
return add_query_arg( 'ver', time(), $src );
}
@mhmanik
mhmanik / vc_custom_icon_set.php
Created November 14, 2017 06:16 — forked from zecka/vc_custom_icon_set.php
Add a custom icon set from icomoon to visual composer vc_icon shortcode
<?php
// Add new custom font to Font Family selection in icon box module
function zeckart_add_new_icon_set_to_iconbox( ) {
$param = WPBMap::getParam( 'vc_icon', 'type' );
$param['value'][__( 'IcoMoon', 'total' )] = 'icomoon';
vc_update_shortcode_param( 'vc_icon', $param );
}
add_filter( 'init', 'zeckart_add_new_icon_set_to_iconbox', 40 );
@mhmanik
mhmanik / stickySidebar.js
Created March 29, 2017 07:21 — forked from perminder-klair/stickySidebar.js
Sticky Sidebar jQuery
var $sticky = $('.sticky');
var $stickyrStopper = $('.sticky-stopper');
if (!!$sticky.offset()) { // make sure ".sticky" element exists
var generalSidebarHeight = $sticky.innerHeight();
var stickyTop = $sticky.offset().top;
var stickOffset = 120;
var stickyStopperPosition = $stickyrStopper.offset().top;
var stopPoint = stickyStopperPosition - generalSidebarHeight - stickOffset;
var diff = stopPoint + stickOffset;
@mhmanik
mhmanik / woocommerce-custom-cart-item-data.php
Created March 25, 2017 15:30 — forked from RadGH/woocommerce-custom-cart-item-data.php
Get and set custom cart item/product information prior to WooCommerce checkout, and carry those valus over to Order Item Metadata.
<?php
// UPDATE: Stefan from Stack Overflow has explained a better way to handle cart item data.
// See http://stackoverflow.com/a/32327810/470480
// ----------------------
/*
Instructions:
WTF: Get the AJAX add to cart button on Shop/Category/Search pages in WooCommerce. (AJAX works only for simple products)
HOW:
1) create a directory, name it "woocommerce" put it in your theme root.
2) copy/pasta from woocommerce plugin directory the content-product.php file
3) at the end of the (content-product.php) file, paste the code below:
<?php
global $product;
echo apply_filters( 'woocommerce_loop_add_to_cart_link',
@mhmanik
mhmanik / Font Awesome 4 icons
Created November 28, 2016 10:53 — forked from blackfyre/Font Awesome 4 icons
This is a php array of all the icons found in Font Awesome 4.0.3
<?php
$icon[] = 'fa-glass';
$icon[] = 'fa-music';
$icon[] = 'fa-search';
$icon[] = 'fa-envelope-o';
$icon[] = 'fa-heart';
$icon[] = 'fa-star';
$icon[] = 'fa-star-o';
$icon[] = 'fa-user';
<?php
/**
* Escape all translations with
*/
__( ‘Some String’, ‘text-domain’ ); _e( ‘Some string’, ‘text-domain’ );.
/**
* When there is no HTML use:
*/
@mhmanik
mhmanik / reset.less
Created August 3, 2016 07:13 — forked from joshuapowell/reset.less
LESS: Global LESS CSS reset that gives elements default formatting.
/**
* Global Reset of all HTML Elements
*
* Resetting all of our HTML Elements ensures a smoother
* visual transition between browsers. If you don't believe me,
* try temporarily commenting out this block of code, then go
* and look at Mozilla versus Safari, both good browsers with
* a good implementation of CSS. The thing is, all browser CSS
* defaults are different and at the end of the day if visual
* consistency is what we're shooting for, then we need to
@mhmanik
mhmanik / WP:woo-cat-image.php
Created July 21, 2016 10:58
Woocommerce display category image
<?php
/**
* http://stackoverflow.com/questions/12717112/how-to-display-woocommerce-category-image
*/
$args = array(
'number' => $number,
'orderby' => $orderby,
'order' => $order,
'hide_empty' => $hide_empty,
'include' => $ids,
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(