Skip to content

Instantly share code, notes, and snippets.

@vishalbasnet23
Created November 17, 2015 07:34
Show Gist options
  • Save vishalbasnet23/2ee6715a20c59e1c4b74 to your computer and use it in GitHub Desktop.
Save vishalbasnet23/2ee6715a20c59e1c4b74 to your computer and use it in GitHub Desktop.
Overriding WooCommerce single-product-reviews.php from Plugin.
function override_template( $template ) {
global $woocommerce;
if ( get_post_type() == 'product' && file_exists( untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/woocommerce/single-product-reviews.php' ) ) {
return $this->cpm_woopr_plugin_path() . '/woocommerce/single-product-reviews.php';
}
return $woocommerce->comments_template_loader($template);
}
add_filter( 'comments_template', 'override_template', 100, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment