Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //This filter will look an alternate template that matches displaystyle in the querystring
- //http://mysite.com/products/my-product/?displaystyle=style1 will search for foxyshop-single-product-style1.php
- //If it doesn't find it, the original file will be returned
- //This feature is helpful for creating different styles which can be referenced by changing the querystring
- //This snippet can go in functions.php
- add_filter('foxyshop_template_redirect', 'my_foxyshop_template_redirect', 5, 2);
- function my_foxyshop_template_redirect($final_url, $original_filename) {
- if (isset($_GET['displaystyle'])) {
- $newfilename = str_replace(".php", '-' . sanitize_title_with_dashes($_GET['displaystyle']) . '.php', $original_filename);
- if (file_exists(STYLESHEETPATH . '/' . $newfilename)) {
- return STYLESHEETPATH . '/' . $newfilename;
- }
- }
- return $final_url;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement