• Hello and thank you for being there,

    Is there a way to have the same archive template for all post types except for the blog?

    I don’t think creating an archive-{name of the post type}.php template is a good idea if I’m always going to have the same archive template for all my post types archives, except for the blog archive.

    Any ideas?

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have used the code below to select a special template for a group of categories. You could use the same idea to select a template for certain post types. single.php was renamed single-default.php and the file below used as single.php:

    <?php
    // single.php is now in single-default.php
    // We want to use stay-in-category for
    //   PresidentsMsg     6
    //   MeetingPlace      7
    //   DownTheRoad       9
    //   ForSale          10
    //   WantToBuy        11
    //   GoodRoads        12
    //   Barbeque         14
    //   AllAmerican      15
    //   International    16
    //   SteaksAndSeafood 17
    //   OtherFoods       18
    //   EventTalk        19
    //   OtherTopics      20
    $post = $wp_query->post;
    if ( in_category(array(6,7,9,10,11,12,14,15,16,17,18,19,20) )) {
      include(TEMPLATEPATH . '/single-in-category.php'); }
    else {
      include(TEMPLATEPATH . '/single-default.php');
    }
    ?>
    Thread Starter teauser

    (@teauser)

    Hi vtxyzzy,

    Thanks a lot. This actually works. I wasn’t sure if WordPress has an optional template for the archive of all post types except blog posts as part of its template hierarchy. It seems it doesn’t (yet).

    Your code will do the trick! ?? thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Template For all Post Types Except Blog Posts’ is closed to new replies.