single redirection by cat – one cat works the other doesn't
-
Hi guys,
I’ve got a problem that i’ve been trying to solve for weeks now. Basically, i’m building a CMS based site. First a bit of background:
The site uses two custom post types; “profiles” and “minutes”. I’ve defined these in the functions.php file in my theme.
I also have two categories defined; “Profiles” and “Minutes”.
I can successfully create new posts from the dashboard etc. and i tag them by their respective category.
I also use the “more fields” plugin to define custom data fields for use with the “profiles” post type. They all seem to work fine with the post type.
The Problem:
I’m trying to use two seperate single-(posttype).php files for each of the post types to display thier contents. But get this: the “Profile” file works fine but the “Minutes” one doesn’t, it just returns a 404. Here’s the single.php code i’ve got it place to ‘route’ the post types:
<?php $post = $wp_query->post; if (in_category('Profiles')) { include (TEMPLATEPATH . '/single-profile.php'); } elseif (in_category('Minutes')) { include (TEMPLATEPATH . '/single-minute.php'); } else { include (TEMPLATEPATH . '/single-default.php'); } ?>
Now, I’ve tried swapping round the files to test that the single-minute.php file successfully renders in the browser and it does.
I’m a little stuck and have tried a variety of different ways to route the posts to the different single files but to no avail.
Can anyone please help!?
thanks
wishy
- The topic ‘single redirection by cat – one cat works the other doesn't’ is closed to new replies.