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
## Get Your Order ID | |
$order_id = 232323 // Change to your order Id | |
$order = wc_get_order( $order_id ); | |
## Get Item Details | |
$product_name = $item_data['name']; | |
$product_id = $item_data['product_id']; | |
$variation_id = $item_data['variation_id']; | |
$quantity = $item_data['quantity']; | |
$tax_class = $item_data['tax_class']; |
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
#Redirect a Single Page | |
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html | |
Redirect 301 /oldpage2.html http://www.yoursite.com/folder/ | |
#Redirect Entire Website | |
Redirect 301 / http://yournewsite.com/ | |
Redirect 301 / http://yournewsite.com/ |
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
/** | |
* @snippet WooCommerce Single Page - Move Tabs below the add to cart button | |
* @code https://techskilled.co.uk/snippets/single-page-move-tabs-below-the-add-to-cart-button | |
* @author https://techskilled.co.uk | |
*/ | |
function techskilled_move_tabs(){ | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); | |
add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 70 ); | |
} |
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
/** | |
* @snippet Wordpress Admin - Enable maintenance mode for non-admins | |
* @code https://techskilled.co.uk/snippets/admin-enable-maintenance-mode-for-non-admins-2 | |
* @author https://techskilled.co.uk | |
*/ | |
function wpts_maintenance_mode(){ | |
if(!current_user_can(‘edit_themes’) || !is_user_logged_in()){ | |
wp_die(‘Under Maintenance, please come back soon.’, ‘Under Maintenance – please come back soon.’, array(‘response’ => ‘503’)); | |
} |
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
/** | |
* @snippet Woocommerce Checkout - Add Secure Logo to Checkout Page | |
* @code https://techskilled.co.uk/snippets/woocommerce-checkout-add-secure-logo-to-checkout-page | |
* @author https://techskilled.co.uk | |
*/ | |
function bbloomer_trust_place_order() { | |
echo '<img src="https://www.paypalobjects.com/digitalassets/c/website/marketing/na/us/logo-center/9_bdg_secured_by_pp_2line.png" style="margin: 1em auto">'; | |
} | |
add_action( 'woocommerce_review_order_after_submit', 'bbloomer_trust_place_order' ); |
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
/** | |
* @snippet Wordpress Media Snippet - Media - Allow SVG Media Logo Upload | |
* @code https://techskilled.co.uk/snippets/wordpress-allow-svg-media-logo-upload-snippet | |
* @author https://techskilled.co.uk | |
*/ | |
function ts_mime_types($mimes) { | |
$mimes['svg'] = 'image/svg+xml'; | |
return $mimes; | |
} |
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
/** | |
* @snippet Woocommerce - Single Product - Add Content After Add to Cart | |
* @code https://techskilled.co.uk/snippets/woocommerce-add-content-after-add-to-cart-single-product-page | |
* @author https://techskilled.co.uk | |
*/ | |
function show_content_after_add_to_cart() { | |
echo '<div style="clear: both; padding-top: 20px;"><a style="font-weight: 600;" href="#doit">OR Doing it yourself?</a></div> '; |
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
/** | |
* @snippet single Product - Edit Only 1 left in stock | |
* @code https://techskilled.co.uk/snippets/woocommerce-edit-only-1-left-in-stock-single-product-page | |
* @author https://techskilled.co.uk | |
*/ | |
function techskilled_edit_left_stock( $text, $product ) { | |
$stock = $product->get_stock_quantity(); | |
if ( $product->is_in_stock() && $product->managing_stock() && $stock <= get_option( 'woocommerce_notify_low_stock_amount' ) ) $text .= '. Get it today to avoid 5+ days restocking delay!'; | |
return $text; |
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
/** DISBALE WP-ADMIN FROM NON ADMIN : SOBER MEDIA 13/08/2016 **/ | |
add_action('admin_init', 'no_mo_dashboard'); | |
function no_mo_dashboard() { | |
$isAjax = (defined('DOING_AJAX') && true === DOING_AJAX) ? true : false; | |
//if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') { | |
if(!$isAjax) { | |
if(!current_user_can('administrator')) { | |
wp_redirect('http://www.example.com/'); exit; |
NewerOlder