Created
February 19, 2016 02:20
-
-
Save tolawho/9cfe768137381721bf50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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