Title: Format attribute
Last modified: August 20, 2016

---

# Format attribute

 *  [creativelifeform](https://wordpress.org/support/users/creativelifeform/)
 * (@creativelifeform)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/)
 * Hi there,
 * I’m just wondering about the format attribute of the EM_Events function. Can 
   I have a little more info on this? If I read correctly, I am guessing there is
   a way to reference a specific template file for the layout of the output, but
   I’m not sure how to pass this argument. Would this be correct?
 * `'format'=>'index-events.php'`
 * where index-events is my template for how events should be displayed on the homepage?
 * Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [creativelifeform](https://wordpress.org/support/users/creativelifeform/)
 * (@creativelifeform)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276487)
 * Ah okay that was not correct. To anyone else who is wondering this, here’s a 
   solution:
 *     ```
       <?php
   
           ob_start();
           include 'events-index.php';
           $result = ob_get_contents();
           ob_end_clean();
   
           if (class_exists('EM_Events'))
           {
                   echo EM_Events::output( array('limit'=>3,'orderby'=>'start_date','format'=>$result) );
           }
       ?>
       ```
   
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276491)
 * you can use shortcodes to display events in your homepage.
 * e.g.
    On the default twentyeleven theme the homepage displays post Hello World!
   and if you add shortcode [events_list] to it; it will let display events list
   in homepage.
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276501)
 * the format att is meant to accept a string with placeholders.
 * however, your idea is actually a pretty neat suggestion…. like a template=> option
 *  Thread Starter [creativelifeform](https://wordpress.org/support/users/creativelifeform/)
 * (@creativelifeform)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276582)
 * Yep that’s pretty much what I’ve done, it works perfectly. Shouldn’t be too hard
   to write a class for it and include it as an option for this function I guess.
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276654)
 * one thing I’d do though is force a specific template name for security, e.g. 
   template => ‘loop’
 * which points to something like templates/parts/loop.php
 *  Thread Starter [creativelifeform](https://wordpress.org/support/users/creativelifeform/)
 * (@creativelifeform)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276689)
 * Just curious, why would the current method pose a security risk?
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276691)
 * if someone gets access to that variable, they can load/execute anything on your
   filesystem.
 * this way, just clean that string (i.e. alphanumeric + dashes only) and slot it
   into the filename.
 * not a high risk, but still worth taking precaution i think
 *  Thread Starter [creativelifeform](https://wordpress.org/support/users/creativelifeform/)
 * (@creativelifeform)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276711)
 * Yeah when I write the class I will do as you suggested, thanks!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Format attribute’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [creativelifeform](https://wordpress.org/support/users/creativelifeform/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/format-attribute/#post-2276711)
 * Status: not resolved