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 | |
/* | |
* First we need to let WordPress know that our theme supports the output of the "custom-logo" | |
* We do this by making the "add_theme_support( 'custom-logo' ) plus arrays declaration as follow. | |
* File: functions.php | |
*/ | |
function themename_setup() { | |
add_theme_support( 'custom-logo', array( | |
'height' => 250, | |
'width' => 75, |
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 | |
function themeslug_custom_sales_price( $price, $product ) { | |
$currency = get_woocommerce_currency_symbol(); | |
$percentage = round( $product->regular_price - $product->sale_price, 2 ); | |
return $price . sprintf( __(' <br /><span class="price_save">You Save ' . $currency . '%s', 'woocommerce' ), $percentage . '</span>' ); | |
} | |
add_filter( 'woocommerce_sale_price_html', 'themeslug_custom_sales_price', 10, 2 ); ?> |
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 | |
function themeslug_discount_product($price, $product){ | |
global $product; | |
$discount = $product->sale_price ; | |
if ($discount) { | |
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); | |
$wc_percent = $price .' <span class="product-discount">'. sprintf( __('%s', 'themeslug' ), $percentage . '% OFF</span>' ); | |
} | |
else{ | |
$wc_percent = $price .' <span class="no_discount">'. sprintf( __('0%s', 'themeslug' ), $percentage . '% OFF</span>' ); |
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 | |
/* | |
* This function assumes you have a customizer setting of the type 'text-field' setup ready for your custom input | |
* If not then it will return the default that can be changed manually @line 11 | |
*/ | |
function themeslug_woocommerce_sale_flash( $text ) { | |
if ( get_theme_mod( 'themeslug_onsale_text' ) !='' ) { | |
$onsale = get_theme_mod( 'themeslug_onsale_text' ); | |
} else { |
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
@media only screen and (max-width: 760px) { | |
.woocommerce-cart #content .woocommerce table.shop_table td, | |
.woocommerce-cart #content .woocommerce-page table.shop_table td, | |
.woocommerce-checkout #content .woocommerce table.shop_table td, | |
.woocommerce-checkout #content .woocommerce-page table.shop_table td { | |
padding: 3px 0; | |
border-top: 0; | |
} |
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 | |
/* | |
* As a wise theme reviewer advised - theme options are required to be within the Customizer! | |
*/ | |
function themename_custom_css_adjust() { | |
$css = ''; | |
$bg_color = get_theme_mod( 'themename_menu_bg_color' ); | |
$link_color = get_theme_mod( 'themename_last_link_color' ); | |
$link_hover = get_theme_mod( 'themename_last_link_hover' ); |
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 | |
add_filter( 'rewrite_rules_array', function( $rules ) { | |
$new_rules = array( | |
'shop/([^/]*?)/page/([0-9]{1,})/?$' => 'index.php?product_cat=$matches[1]&paged=$matches[2]', | |
'shop/([^/]*?)/?$' => 'index.php?product_cat=$matches[1]', | |
); | |
return $new_rules + $rules; | |
} ); |
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 custom redirection | |
add_action( 'template_redirect', 'wc_custom_redirect_after_purchase' ); | |
function wc_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { | |
wp_redirect( 'http://mysite.com/thank-you-for-your-order/' ); | |
exit; | |
} | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
// Font Awesome v. 4.6. | |
function jt_get_font_icons() { | |
return array( | |
'fa-glass' => 'f000', | |
'fa-music' => 'f001', | |
'fa-search' => 'f002', | |
'fa-envelope-o' => 'f003', |
OlderNewer