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
$https_options = array( 'HTTP_CF_VISITOR', 'HTTP_X_FORWARDED_PROTO' ); | |
foreach ( $https_options as $https_option ) { | |
if ( isset( $_SERVER[ $https_option ] ) | |
&& ( strpos( $_SERVER[ $https_option ], 'https' ) !== false ) | |
) { | |
$_SERVER[ 'HTTPS' ] = 'on'; | |
} | |
} |
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
function swp_wpseo_canonical_ssl( $url ) { | |
$url = str_replace( 'http://', 'https://', $url ); | |
return $url; | |
} | |
add_filter( 'wpseo_canonical', 'swp_wpseo_canonical_ssl' ); |
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_order_number', 'swp_woocommerce_order_number_leading_zeros', 10 ); | |
function swp_woocommerce_order_number_leading_zeros( $order_id ) { | |
$max_length = 8; | |
$new_order_id = str_pad( $order_id, $max_length, '0', STR_PAD_LEFT ); | |
return $new_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
add_filter( 'widget_text', 'do_shortcode' ); |
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
remove_action('wp_head', 'wp_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
add_filter( 'woocommerce_variable_price_html', 'studiowp_woocommerce_variable_price_html', 10, 2 ); | |
function studiowp_woocommerce_variable_price_html( $price, $product ) { | |
if ( !is_singular( 'product' ) ) { | |
$prices = $product->get_variation_prices( true ); | |
if ( empty( $prices['price'] ) ) { | |
$price = apply_filters( 'woocommerce_variable_empty_price_html', '', $this ); | |
} else { | |
$prefix = 'From '; | |
$suffix = ''; |
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 | |
$studiowp_remove_orderby = array( 'rating', 'popularity', 'price', 'price-desc' ); | |
add_action( 'init', 'studiowp_init_orderby' ); | |
function studiowp_init_orderby() { | |
global $studiowp_remove_orderby; | |
if ( !is_admin() && isset( $_GET['orderby'] ) ) { | |
if ( in_array( $_GET['orderby'], $studiowp_remove_orderby ) ) { | |
wp_redirect( home_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_variable_price_html', 'studiowp_woocommerce_variable_price_html', 10, 2 ); | |
function studiowp_woocommerce_variable_price_html( $price, $product ) { | |
if ( !is_singular( 'product' ) ) { | |
$prices = $product->get_variation_prices( true ); | |
if ( empty( $prices['price'] ) ) { | |
$price = apply_filters( 'woocommerce_variable_empty_price_html', '', $this ); | |
} else { | |
$prefix = 'From '; | |
$suffix = ''; |
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_action( 'woocommerce_after_add_to_cart_button', 'studiowp_woocommerce_after_add_to_cart_button' ); | |
function studiowp_woocommerce_after_add_to_cart_button() { | |
global $product; | |
$my_categories = array( 15, 16 ); | |
$is_my_category = false; | |
$product_categories = $product->get_category_ids(); | |
foreach ( $my_categories as $my_category ) { | |
if ( in_array( $my_category, $product_categories ) ) { | |
$is_my_category = true; | |
} |
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_action( 'woocommerce_account_menu_items', 'studiowp_woocommerce_account_menu_items' ); | |
function studiowp_woocommerce_account_menu_items( $items ) { | |
unset( $items['downloads'] ); | |
return $items; | |
} |
OlderNewer