Custom template escapes slashes?

Forums › Forums › Search & Filter Pro › Custom template escapes slashes?

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #2173

    I’m trying to use the template override when searching my woocommerce products.

    The woocommerce templates are usually stored in ‘theme/woocommerce/archive-product.php’, but when entering ‘woocommerce/archive-product.php’ as custom template in the search form config, the slash is stripped so it becomes ‘woocommercearchive-product.php’.

    Moving archive-product.php to the themes root folder seems to work, but then I have 2 template files serving the same prupose… Any other options?

    Ross Moderator
    #2175

    Hey Mike

    I didn’t notice this! Unfortunately you’ll have to go with this for now, I’ll try to update the plugin so your slashes don’t get stripped and the correct path is resolved.

    Thanks

    Anonymous
    #2178

    Thanks for the help!

    My fix for the time being is to simply create a new archive-product.php in the theme root with this:

    <?php 
    
    add_filter('body_class','my_class_names');
    function my_class_names($classes) {
    	// add 'class-name' to the $classes array
    	$classes[] = 'woocommerce';
    	// return the $classes array
    	return $classes;
    }
    
    include 'woocommerce/archive-product.php';
    
    ?>

    i should note that my_class_names() is an unrelated fix 😉

    Ross Moderator
    #2210

    Great thanks for the update, would be useful to other Woocommerce users too 🙂 Hope to get that problem solved in a forthcoming update.

    Thanks

Viewing 4 posts – 1 through 4 (of 4 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.