Skip to content

Instantly share code, notes, and snippets.

@tranquangchau
Created December 7, 2015 15:42
Show Gist options
  • Save tranquangchau/9af511200dee66081548 to your computer and use it in GitHub Desktop.
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()
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