Created
December 7, 2015 15:42
-
-
Save tranquangchau/9af511200dee66081548 to your computer and use it in GitHub Desktop.
ok lựa chọn giao diện hiện thị cho 1 category trong wordpress file \wp-includes\template.php trong hàm get_single_template()
This file contains hidden or 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
function get_single_template() { | |
$object = get_queried_object(); | |
$templates = array(); | |
if ( ! empty( $object->post_type ) ) | |
$templates[] = "single-{$object->post_type}.php"; | |
// $templates[] = "single.php"; | |
$the_categories = get_the_category(); | |
//var_dump($the_categories);exit(); | |
if ($the_categories[0]->category_nicename=='rem_romain') { | |
$templates[] = "rm_theme.php"; | |
//echo '123';exit(); | |
} else { | |
$templates[] = "test_content_single.php"; | |
//echo '321';exit(); | |
} | |
return get_query_template( 'single', $templates ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment