WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. dadadmin
    Member
    Posted 1 year 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.

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

  2. angelo
    NetWebLogic Support
    Posted 1 year ago #

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year 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);
    $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

  4. teeray
    Member
    Posted 11 months 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:

    <?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>
    ');?>
  5. teeray
    Member
    Posted 11 months 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 11 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic