Home › Forums › Calendar Products › Events Calendar PRO › Events category template
- This topic has 9 replies, 3 voices, and was last updated 10 years, 10 months ago by
Support Droid.
-
AuthorPosts
-
August 22, 2012 at 2:16 am #23932
David
ParticipantI’m trying to work out what template I can create to control the category view pages. I’ve got various events categories and for each category I would like a specific template. I know how this usually works with categories and taxonomies…
category-music.php / taxonomy-music.php etc etc but I’m not sure what I should name my template for the events categories.For example, this is one of my category urls:
http://www.myurl.com/events/category/performancesI’ve tried using ‘category-performances.php’ but that didn’t seem to work. I know this is more of a WordPress question but if anyone can shed some light I’d appreciated it!
August 22, 2012 at 2:26 am #23933David
ParticipantI’ve noticed it uses the list template for all of the category pages so will have a look at that template and see if there is anything I can do – maybe an if statement to control what users see for various categories.
August 23, 2012 at 7:01 am #23996Barry
MemberI’m going to double check this, but I don’t think the regular pattern used in the WordPress template hierarchy applies here – which is why {taxonomy}-performances.php won’t work.
You are probably on track with adding an if statement at the top of the relevant template, you could for instance place this at the top of ecp-page-template.php and combine it with get_template_part() calls to effectively build your own hierarchy.
It sounds like you are on track however – let us know what you come up with!
August 23, 2012 at 7:20 am #23999David
ParticipantI’ve tried adding the following but it doesn’t seem to recognise the categories & always displays the ‘Other cats’ text. I tried using the slug & the post ID also, same result. This code was placed in ‘list.php’.
`
PerformancesSpecial Events
Other cats
`August 23, 2012 at 7:29 am #24000Barry
MemberHi David. This forum doesn’t handle code listings very well – the best way to share code is to use a service like Pastebin or Gist and post the link to your code back here.
August 23, 2012 at 7:32 am #24001David
Participantoops, sorry.
http://pastebin.com/5uZTcMqPAugust 23, 2012 at 9:30 am #24003Barry
MemberI don’t think that will work since by itself is_category() doesn’t pick up on custom taxonomies, such as event categories. You would need to use is_tax() for that.
What I was thinking of was something along these lines – http://pastebin.com/QZwHKq3W – that being a modified version of ecp-page-template.php … of course you would need to modify the category names in the switch block and also create the new templates.
August 23, 2012 at 9:36 am #24004David
ParticipantMany thanks, I’ll give that a go, I thought I was off base but not a million miles away! Thanks!
August 23, 2012 at 9:45 am #24006Barry
MemberYeah it worked for me when I ran up a quick test but let me know how you get on anyway. Like so many of these things there are a load of different permutations and ways to approach it, so play around and do what’s comfortable for you 🙂
July 7, 2015 at 6:25 am #977595Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Events category template’ is closed to new replies.
