WordPress.org

Support

Support » Plugins and Hacks » Events Manager » [Resolved] Different Template Layouts for Different Event Category

[Resolved] Different Template Layouts for Different Event Category

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

    http://wordpress.org/extend/plugins/events-manager/

Viewing 5 replies - 1 through 5 (of 5 total)
  • angelo_nwl

    @angelo_nwl

    NetWebLogic Support

    Plugin Author Marcus

    @netweblogic

    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);
    $EM_Category->output('placeholders');

    $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

    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:

    <?php
      $EM_Category = new EM_Category($term);
    $EM_Category->output('<div class="post-excerpt">
    <div class="post-summary">
       <h5>#_EVENTLINK</h5>
    <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
    ">#_CONTACTNAME</a>
    </span>{has_location}
    <br/>
     #_LOCATIONNAME, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}<br/>
    #_EVENTEXCERPT
    </div>
    
    </div>
    
    <div class="post-thumbnail">
    #_EVENTIMAGE{90,90}
    </div>
    
    </div>
    ');?>

    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/

    Plugin Author Marcus

    @netweblogic

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

    http://pastebin.com/MSe9SvBq

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Different Template Layouts for Different Event Category’ is closed to new replies.
Skip to toolbar