⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains hidden or 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 | |
//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_save_product_variation', 'save_variable_fields', 10, 1 ); | |
/** |
This file contains hidden or 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
margin-top: -0px; | |
background-color: rgb(255, 255, 255); | |
box-shadow: 0px 0px 38px 0px rgba(0, 0, 0, 0.1); | |
-webkit-box-shadow: 0px 0px 38px 0px rgba(0, 0, 0, 0.1); | |
-moz-box-shadow: 0px 0px 38px 0px rgba(0, 0, 0, 0.1); | |
-ms-box-shadow: 0px 0px 38px 0px rgba(0, 0, 0, 0.1); | |
padding: 30px; */ | |
z-index: 10; | |
position: relative; | |
display: inline-block; */ |
This file contains hidden or 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
// Login log out functionality in menu, add stuff to menu | |
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 ); | |
function add_loginout_link( $items, $args ) { | |
if (is_user_logged_in() && $args->theme_location == 'top_nav') { | |
$items .= '<li><a href="'. wp_logout_url() .'">Log Out</a></li>'; | |
} | |
elseif (!is_user_logged_in() && $args->theme_location == 'top_nav') { | |
$items .= '<li><a href="'. site_url('wp-login.php') .'">Log In</a></li>'; | |
} | |
return $items; |
This file contains hidden or 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 | |
//* Do NOT include the opening php tag | |
//* Make Font Awesome available | |
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' ); | |
function enqueue_font_awesome() { | |
wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css' ); | |
} |
This file contains hidden or 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
/** | |
* Hide free shipping option when Standard Shipping is available | |
* | |
* @param array $available_methods | |
*/ | |
function mwe_hide_free_shipping_when_standard_shipping_is_available($available_methods) { | |
// remove standard shipping option | |
if (isset($available_methods['free_shipping']) AND isset( $available_methods['flat_rate'])) { | |
unset($available_methods['free_shipping']); |
This file contains hidden or 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
$hide_main_offer = false; | |
if($product->is_type('variable')) | |
{ | |
ob_start(); | |
echo $product->get_price_html(); | |
$price_html = ob_get_clean(); |
This file contains hidden or 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
// Use WC 2.0 variable price format, now include sale price strikeout | |
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 ); | |
add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 ); | |
function wc_wc20_variation_price_format( $price, $product ) { | |
// Main Price | |
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); | |
$price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); | |
// Sale Price | |
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) ); | |
sort( $prices ); |
This file contains hidden or 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_currency_symbol', 'change_denmark_existing_currency_symbol', 10, 2); | |
function change_denmark_existing_currency_symbol( $currency_symbol, $currency ) { | |
switch( $currency ) { | |
case 'DKK' : $currency_symbol = 'DKK'; break; | |
} | |
return $currency_symbol; | |
} |