Skip to content

Instantly share code, notes, and snippets.

@rashmimalpande
Last active September 25, 2017 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rashmimalpande/d80241803ab829305e58a455cbf69e29 to your computer and use it in GitHub Desktop.
Save rashmimalpande/d80241803ab829305e58a455cbf69e29 to your computer and use it in GitHub Desktop.
public function include_files() {
include_once('custom.html'); //path to your html file
}
public function add_custom_html() {
global $post;
$product_id = $post->ID;
$categories = get_the_terms( $product_id, 'product_cat' );
if( empty ($categories)){
return;
}
foreach($categories as $cat){
if( 'men' == $cat->slug ) {
//include the html file here
$this->include_files();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment