Skip to content

Instantly share code, notes, and snippets.

View aarifhsn's full-sized avatar

Md. Arif Hassan aarifhsn

View GitHub Profile
/**
* 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');
@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) : ?>
/**
* 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' );
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' );
}
add_theme_support( 'post-thumbnails', array( 'post','news-posts') );
add_image_size( 'news_post_thumb', 200, 200, true );
<!--NEWS SECTION-->
<?php
global $post;
$args = array ('post_type'=> 'news-posts','posts_per_page' =>3);
$the_query = new WP_Query($args); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
/**
*Custom Post Types
*/
function wpdevs_custom_post() {
register_post_type( 'news-posts',
array(
'labels' => array(
'name' => __( 'News Posts', 'hellothirteen' ),
/**
* Filters wp_title to print a neat <title> tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/
function WpDevs_wp_title( $title, $sep ) {
if ( is_feed() ) {
return $title;
<?php
if ( is_home() ) {
query_posts( 'cat=-1,-2,-3' );
}
?>
<?php
if ( is_home() ) {
query_posts( 'cat=-3' );
}
?>