【wordpress】single.phpをカテゴリ分岐する

 

<?php
    $post = $wp_query->post;
    if(in_category('information')){
        include(TEMPLATEPATH . '/single-information.php');
    }
    elseif(in_category('event')){
        include(TEMPLATEPATH . '/single-event.php');
    }
    elseif(in_category('blog')){
        include(TEMPLATEPATH . '/single-blog.php');
    }
    else{
        include(TEMPLATEPATH . '/single-defalut.php');
    }
?>

 

single.phpをカテゴリ毎に分岐したかったけど、できなくて…