Trying to load custom template for different plugins
-
I am working on e-commerce website and i am using 2 plugins to upload and display product and both of the plugins have different template to show product but when i try to include plugin template to load it only loads first plugin template successfully but when i try to load second plugin template it loads the first plugin template.
here is code for first plugin template include:
function use_custom_template( $template )
{
echo $template;
$template_slug = basename(rtrim( $template, ‘.php’ ));if( ($template_slug === ‘single-product’ || $template_slug === ‘woocommerce’) && is_product() )
{
$template = WCA_DIR . ‘includes/wca-templates.php’;}
return $template;
}add_filter( ‘template_include’, ‘use_custom_template’, 99 );
Code for second plugin template include:
function custom_template( $template )
{
echo $template;
$template_slug = basename(rtrim( $template, ‘.php’ ));if( ($template_slug === ‘single-product’ || $template_slug === ‘woocommerce’) && is_product() )
{
$template = WCS_DIR . ‘/includes/wcs-templates.php’;
}return $template;
}add_filter( ‘template_include’, ‘custom_template’, 99 );
- The topic ‘Trying to load custom template for different plugins’ is closed to new replies.