Events category template

Home Forums Calendar Products Events Calendar PRO Events category template

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #23932
    David
    Participant

    I’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/performances

    I’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!

    #23933
    David
    Participant

    I’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.

    #23996
    Barry
    Member

    I’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!

    #23999
    David
    Participant

    I’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’.

    `
    Performances

    Special Events

    Other cats
    `

    #24000
    Barry
    Member

    Hi 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.

    #24001
    David
    Participant
    #24003
    Barry
    Member

    I 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.

    #24004
    David
    Participant

    Many thanks, I’ll give that a go, I thought I was off base but not a million miles away! Thanks!

    #24006
    Barry
    Member

    Yeah 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 🙂

    #977595
    Support Droid
    Keymaster

    This 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.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Events category template’ is closed to new replies.