wordpress - WooCommerce:Create Custom Product template and how to Call -


by default single-product.php load products page, want call different template on basis of category, let's have category customize have created file category slug single-product-customize.php

problem single-product-customize.php file returning product normal post view(blog page) why it's not loading on product page.

 <?php                  global $post;                 $terms = wp_get_post_terms( $post->id, 'product_cat' );                 foreach ( $terms $term ) $categories[] = $term->slug;                  if ( in_array( 'customize', $categories ) ) {                   woocommerce_get_template_part( 'content', 'single-product-customize' );                 } else {                     woocommerce_get_template_part( 'content', 'single-product' );                 }          ?> 

create template single-product.php called products. can own coding inside that.

{posttype}-product.php way create template post type.

hope helps.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -