Skip to content

Instantly share code, notes, and snippets.

@vovadocent
Created February 10, 2017 09:30
Show Gist options
  • Save vovadocent/13a33789c84c1e12c313bf9b97ed073b to your computer and use it in GitHub Desktop.
Save vovadocent/13a33789c84c1e12c313bf9b97ed073b to your computer and use it in GitHub Desktop.
woo product page template
<?php
add_filter('template_include', 'portfolio_page_template', 99);
function portfolio_page_template($template) {
global $post;
if (!is_archive() && $post->post_type == 'product') {
$tpl = get_field('template_name', $post->ID);
if ($tpl) {
$new_template = locate_template(array($tpl));
return $new_template;
}
}
return $template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment