• Hello! Need you help..

    i am using this code in order to load different template depending on whic h categories..

    <?php

    $post = $wp_query->post;
    if (in_category(‘logo’)) {
    include(TEMPLATEPATH . ‘/single-webtemplate.php’);
    } else {
    include(TEMPLATEPATH . ‘/single-default.php’);
    }

    ?>

    my question is, how about if i am using Custom Post Type category?

    i need a code something like this

    <?php

    $post = $wp_query->post;
    if (post_type(‘logo’)) {
    include(TEMPLATEPATH . ‘/single-webtemplate.php’);
    } else {
    include(TEMPLATEPATH . ‘/single-default.php’);
    }

    ?>

    Thanks in advance..please help me.. =)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Please review the Template Hierarchy. You’re making things much more difficult on yourself than you need to.

    To create a custom template for a given category term foobar, create a file named category-foobar.php. WordPress will automatically use it to display the category archive index for the foobar term.

    Another alternative, if your changes can be defined entirely via CSS, is to ensure that your Theme properly uses the body_class() and post_class() template tags, and then you can target the CSS classes they output.

    Thread Starter jbm_28184

    (@jbm_28184)

    Thanks Chip! I will try it.. will let you know how I came up with.. =)

    Thread Starter jbm_28184

    (@jbm_28184)

    hi Chip! it’s woooooooorking! and it’s far easier than my codes.. thanks again.. rock on!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Unique Template for each Custom Post Type Category’ is closed to new replies.