Skip to content

Instantly share code, notes, and snippets.

@tolawho
Created February 19, 2016 02:20
Show Gist options
  • Save tolawho/9cfe768137381721bf50 to your computer and use it in GitHub Desktop.
Save tolawho/9cfe768137381721bf50 to your computer and use it in GitHub Desktop.
<?php
add_action('template_redirect','my_template_redirect');
function my_template_redirect() {
if (get_post_type() == 'location') {
global $wp_query;
add_post_meta($wp_query->post->ID,'_wp_page_template','custom_template.php',TRUE);
$wp_query->is_page = true;
}
}
// custom template
remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'my_thesis_hook_custom_template');
function my_thesis_hook_custom_template() {
if (get_post_type() == 'location') require_once TEMPLATEPATH . '/custom/location_template.php';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment