Skip to content

Instantly share code, notes, and snippets.

View aarifhsn's full-sized avatar
🎯
Focusing

Md. Arif Hassan aarifhsn

🎯
Focusing
View GitHub Profile
add_theme_support( 'post-thumbnails', array( 'post','news-posts') );
add_image_size( 'news_post_thumb', 200, 200, true );
add_action( 'wp_enqueue_scripts', 'load_touch_punch_js' , 35 );
function load_touch_punch_js() {
global $version;
wp_enqueue_script( 'jquery-ui-widget' );
wp_enqueue_script( 'jquery-ui-mouse' );
wp_enqueue_script( 'jquery-ui-slider' );
wp_register_script( 'woo-jquery-touch-punch', get_stylesheet_directory_uri() . "/js/jquery.ui.touch-punch.min.js", array('jquery'), $version, true );
wp_enqueue_script( 'woo-jquery-touch-punch' );
}
/**
* Set a custom add to cart URL to redirect to
* @return string
*/
function custom_add_to_cart_redirect() {
return 'http://www.yourdomain.com/your-page/';
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );
@aarifhsn
aarifhsn / gist:d0535a720d13369010ce
Created December 25, 2015 08:57
Woocommerce get price in custom loop
<?php
global $woocommerce;
$currency = get_woocommerce_currency_symbol();
$price = get_post_meta( get_the_ID(), '_regular_price', true);
$sale = get_post_meta( get_the_ID(), '_sale_price', true);
?>
<?php if($sale) : ?>
<p class="product-price-tickr"><del><?php echo $currency; echo $price; ?></del> <?php echo $currency; echo $sale; ?></p>
<?php elseif($price) : ?>
/**
* Change on single product panel "Product Description"
* since it already says "features" on tab.
*/
function devswave_product_description_heading() {
return __('YOUR CUSTOM TITLE', 'woocommerce');
}
add_filter('woocommerce_product_description_heading',
'devswave_product_description_heading');