[resolved] If statement on archive page for to get template (3 posts)

  1. Xavvi
    Posted 7 years ago #

    I am using WordPress 2.7 as a cms. I have various categories and subcategories and am using the Navxt breadcrumb plugin. However, I have a slight problem with this plugin. When I have clicked through to a post within a certain category, the links in the breadcrumb to the subcategory and category try to get the archive page, when what I want is to to get the category template page. Here is an example of the breadcrumb:

    Home > category > subcategory > post

    When I click on the subcategory or category it attempts to find the archive page. But I need it to find the specific category template. I am trying to use an if statement in the archive page that says if is category 1 include template for category 1, if is category 2 include template for category 2 etc. This way I would have more control over what is displayed.

    But so far I cannot make it work. I'm sure it must be a simple statement. Can anybody help please?

  2. John Havlik
    Posted 7 years ago #

    You should be able to use is_category() to switch between code blocks, allowing customization for each category. See: http://codex.wordpress.org/Conditional_Tags#A_Category_Page

    Otherwise you can use separate template pages for each category that needs a customized page. See http://codex.wordpress.org/Template_Hierarchy#Category_display

  3. Xavvi
    Posted 7 years ago #

    Thanks for your reply.

    I managed to solve it by (cheating) using a category base plugin that removed the extra category. I feel dirty.

    Here's the plugin if anyone's interested:


Topic Closed

This topic has been closed to new replies.

About this Topic