Events Manager
[resolved] Different Template Layouts for Different Event Category (6 posts)

  1. dadadmin
    Posted 3 years ago #

    In the settings area of the events plug-in I can set my layout for event listings, but that layout is consistent for all layouts. I wanted to have different layouts on different pages if possible.

    For example, I created a nice layout for a page that lists out all of the events from a category. However, If I have two different categories, I want the layout to be a little bit different on each of the category listings defined by my menu items.


  2. angelo_nwl
    NetWebLogic Support
    Posted 3 years ago #

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    If you go the template route, you need to disable overriding with formatting in Settings > Pages > Categories

    In your custom template e.g. taxonomy-event-categories.php you'd probably want to use something like archive.php and NOT use the loop, because you just want to know the category and use our object to output the content in the layout you require.

    then, you'd use something like:

    $EM_Category = new EM_Category($term);

    $term would be either the custom taxonomy object, the id or the slug.

    rinse and repeate for specific taxonomy templates e.g. taxonomy-event-categories-music.php

  4. teeray
    Posted 2 years ago #

    Formatting is disabled, and my template does resemble the archive template. I'm having trouble outputting anything correct, though. Here's the code I attempted to replace <?php get_template_part( 'entry' ); ?> with:

      $EM_Category = new EM_Category($term);
    $EM_Category->output('<div class="post-excerpt">
    <div class="post-summary">
    <div class="entry-meta">
    <time class="date" datetime="#_EVENTDATES ">
                #j #F #Y#@_{ \u\n\t\i\l j F Y},  #_EVENTTIMES</time>
    <span class="meta-sep">  /  </span>
    <span class="author"><a href="#_CONTACTPROFILEURL
     #_LOCATIONNAME, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}<br/>
    <div class="post-thumbnail">
  5. teeray
    Posted 2 years ago #

    So my apologies for the last post - i think i understand this correctly now.

    However I still can't seem to get it to work. Can I confirm that the category ID should be the category slug without apostrophes, and placeholders should be replaced by the html and placeholders per my example above?

    I do this, and I get nothing displayed. Per this page: http://unfffp.volumesquared.com/events/categories/cpf/

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    I have made a boilerplate file which produces the same result as the default content when 'Override with Formats' is enabled.


    The crucial line is here:

    $taxonomy = get_queried_object();
    $EM_Category = em_get_category($taxonomy->term_id);

    This is specific for twenty twelve, but the PHP is the same, so you'll need to adjust accordingly.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic