This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get post image. | |
*/ | |
function wds_get_post_image( $size = 'thumbnail' ) { | |
// Check for featured image | |
if ( has_post_thumbnail() ) { | |
the_post_thumbnail( $size ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CART CONTENTS | |
* Mostra informação sobre conteúdo actual do carrinho | |
*/ | |
add_action( 'genesis_site_title', 'mw_show_cart_contents' ); | |
function mw_show_cart_contents() | |
{ | |
global $woocommerce; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Esconder as opções de pré-visualização no front-end para Banners | |
* @return [type] [description] | |
*/ | |
function posttype_admin_css() { | |
global $post_type; | |
$post_types = array( | |
/* set post types */ | |
'banners', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Auto Complete all WooCommerce orders. | |
* http://docs.woothemes.com/document/automaticaaly-complete-orders/ | |
*/ | |
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); | |
function custom_woocommerce_auto_complete_order( $order_id ) { | |
global $woocommerce; | |
if ( ! $order_id ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom Columns to Woo Orders Page | |
* @SEE: http://stackoverflow.com/questions/13683162/woocommerce-show-custom-column | |
*/ | |
add_filter( 'manage_edit-shop_order_columns', 'MY_COLUMNS_FUNCTION' ); | |
function MY_COLUMNS_FUNCTION( $columns ) { | |
$new_columns = ( is_array( $columns ) ) ? $columns : array(); | |
unset( $new_columns['order_actions'] ); | |
//edit this for you column(s) | |
//all of your columns will be added before the actions column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Skip the Cart | |
* @see: http://stackoverflow.com/questions/15592633/woocommerce-add-to-cart-button-redirect-to-checkout | |
*/ | |
add_filter( 'add_to_cart_redirect', 'redirect_to_checkout' ); | |
function redirect_to_checkout() { | |
global $woocommerce; | |
$checkout_url = $woocommerce->cart->get_checkout_url(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_billing_fields', 'wc_npr_filter_phone', 10, 1 ); | |
function wc_npr_filter_phone( $address_fields ) { | |
$address_fields['billing_phone']['required'] = false; | |
return $address_fields; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_checkout_fields', 'reorder_woo_fields' ); | |
function reorder_woo_fields( $fields ) { | |
//move these around in the order you'd like | |
$fields2['billing']['billing_first_name'] = $fields['billing']['billing_first_name']; | |
$fields2['billing']['billing_last_name'] = $fields['billing']['billing_last_name']; | |
$fields2['billing']['billing_company'] = $fields['billing']['billing_company']; | |
$fields2['billing']['billing_address_1'] = $fields['billing']['billing_address_1']; | |
$fields2['billing']['billing_address_2'] = $fields['billing']['billing_address_2']; | |
$fields2['billing']['billing_city'] = $fields['billing']['billing_city']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_add_to_cart_message', 'woocommrece_custom_add_to_cart_message' ); | |
function woocommrece_custom_add_to_cart_message() { | |
global $woocommerce; | |
// Output success messages | |
if ( get_option( 'woocommerce_cart_redirect_after_add' ) == 'yes' ) { | |