chris2006
Member
Posted 3 years ago #
Hi,
When creating a new post and assigning it to a specific category (say, video) i would like the post to be displayed using a specific (video)single.php template.
Does anyone know the code to make this work?
i have 4 categories i would like to do this with.
When selected:
cat1 or cat 2 = newssingle.php
cat3 or cat 4 = videosingle.php
Any help would be fantastic!
Thankyou.
if (in_category(1) || in_category(2)) include 'newsingle.php';
else if (in_category(3) || in_category(4)) include 'videosingle.php';
chris2006
Member
Posted 3 years ago #
Thats great thanks!
Do i add this to the index.php template in the loop?
You'd probably want to put that in the single.php file.
did this work for you? i'm having the same problem, but so far i haven't put that code in a place that doesn't make my page go wacky.
where in the single.php file did you put it?
I would like to link to a different single.php from my archive page.
Let's say home.php links to single.php
and archive.php links to single_x.php
Any ideas?
Felix
//---> I just opened a new question for this!
http://wordpress.org/support/topic/24125
ok i used this but it looks like its putting one template on top of the other. single_x displays properly but i want it to display INSTEAD of single.php not alongside it. should i use another word besides 'include'?