Skip to content

Instantly share code, notes, and snippets.

@hemusyl
hemusyl / Global Post Ex.3
Created January 1, 2015 18:55
Global Post From Rasel
<?php
global $post;
$args = array( 'posts_per_page' => 10, 'post_type'=> 'custom-post-type' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php
$job_link= get_post_meta($post->ID, 'job_instructions', true);
?>
@hemusyl
hemusyl / Switch Between 3-Column and 4-Column Grid
Created January 4, 2015 08:55
Switch Between 3-Column and 4-Column Grid
<?php
/**
* Switch between 3-column and 4-column layout grid
*/
add_filter( 'wpsight_layout', 'wpsight_custom_layout', 11 );
function wpsight_custom_layout( $layout ) {
if( $layout == 'three' )
return 'four';
return 'three';
}
@hemusyl
hemusyl / Mastering WooCommerce Products Custom Fields
Last active August 29, 2015 14:18
Mastering WooCommerce Products Custom Fields
http://www.remicorson.com/mastering-woocommerce-products-custom-fields/#comment-14347
// Display Fields
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
// Save Fields
add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
function woo_add_custom_general_fields() {
@hemusyl
hemusyl / Dhaka-wp1
Last active August 29, 2015 14:19
Dhaka-wp
<?php
----------------------------------------------------------
For style css
/*
Theme Name: Payra TV
Theme URI: http://www.payratv.com
Author: Humayun Kabir
Author URI: http://www.hkfolio.com/
Description: This theme created for payratv.
@hemusyl
hemusyl / Woocode
Created April 13, 2015 19:23
Woocode
http://docs.woothemes.com/documentation/plugins/woocommerce/ All documentation is here
http://fuyuko.net/woocommerce-cheat-sheet-single-product-page/
<?php
http://docs.woothemes.com/document/editing-product-data-tabs/
===================================================================================
http://code.tutsplus.com/articles/an-introduction-to-theming-woocommerce-for-wordpress--wp-31577
Disabling the Default Stylesheet and Starting From Scratch
//code to your themes functions.php
@hemusyl
hemusyl / Shipping Method API
Last active February 18, 2016 07:12 — forked from mikejolley/gist:6713608
Shipping Method API
https://docs.woothemes.com/document/shipping-method-api/
<?php
/*
Plugin Name: Your Shipping plugin
Plugin URI: http://woothemes.com/woocommerce
Description: Your shipping method plugin
Version: 1.0.0
Author: WooThemes
Author URI: http://woothemes.com
*/
<?php
/**
* This code shows pagination for WooCommerce shortcodes when it's embeded on single pages.
* Include into functions.php.
*/
if ( ! is_admin() ) {
// ---------------------- FRONTPAGE -------------------
if ( defined('WC_VERSION') ) {
// front end
function custom_front_scripts() {
wp_enqueue_style( 'front-css', plugins_url('/lib/css/front-css.css', __FILE__), array(), null, 'all' );
wp_enqueue_script( 'front-init', plugins_url('/lib/js/front.init.js', __FILE__) , array('jquery'), null, true );
}
add_action('wp_enqueue_scripts', 'custom_front_scripts' );
// back end
function custom_admin_scripts() {
@hemusyl
hemusyl / gist:eef1bd5bc018c5e9f2e0
Last active August 29, 2015 14:26 — forked from corsonr/gist:9152652
WooCommerce : add custom fields to product variations
<?php
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 );
/**
@hemusyl
hemusyl / gist:b46781831d6d7d05687a
Last active August 29, 2015 14:26 — forked from mikejolley/gist:1565309
WooCommerce - Filters to add custom currencies and symbols
add_filter( 'woocommerce_currencies', 'add_my_currency' );
function add_my_currency( $currencies ) {
$currencies['ABC'] = __( 'Currency name', 'woocommerce' );
return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
function add_my_currency_symbol( $currency_symbol, $currency ) {