Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active March 21, 2018 20:20
Show Gist options
  • Save BFTrick/1b5df49d5d4acdcb38c37e8dfdd7d48c to your computer and use it in GitHub Desktop.
Save BFTrick/1b5df49d5d4acdcb38c37e8dfdd7d48c to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Pixel Perfect Webinar Changes
Description: The changes for the Pixel Perfect Webinar
Version: 1.0.0
Author: Patrick Rauland
Author URI: https://speakinginbytes.com
*/
// We're overriding the default behavior for SKUs
add_filter( 'wc_product_sku_enabled', 'patricks_remove_product_page_skus' );
/*
This function checks to see if a (front end) product detail page is loaded.
If so it returns false and does nothing (instead of the usual behavior and rendering the SKU)
If it's not a single product page it does the default action which is called $enabled.
*/
function patricks_remove_product_page_skus( $enabled ) {
if ( ! is_admin() && is_product() ) {
return false;
}
return $enabled;
}
// We're going to run a function after WooCommerce is loaded
add_action( 'woocommerce_loaded', 'patricks_remove_meta_info' );
/*
We're removing some default functionality. In this case hiding all of the meta information (categories, tags, etc) on the product page.
*/
function patricks_remove_meta_info( ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
// by enabling the line below we can display the categories below the reviews.
// add_action( 'woocommerce_after_main_content', 'woocommerce_template_single_meta', 5 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment