Title: Adding multiple template support
Last modified: August 24, 2018

---

# Adding multiple template support

 *  Resolved [Dieter Pfenning](https://wordpress.org/support/users/winball/)
 * (@winball)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/adding-multiple-template-support/)
 * Hi,
 * thank you for this great plugin.
 * I did implement three minor chnages to ics-calendar.php to have multiple templates
   supported. Beside the month view i did need a list view used in sidebars.
 * Line 162 changed: include(dirname(__FILE__) . ‘/templates/’.$args[‘template’]);
 * Line 182 inserted: ‘template’ => ‘calendar-month.php’,
 * Line 190 inserted: ‘template’ => $template,
 * With these little changes the plugin now supports multiple templates which can
   be defined with the new shortcode parameter “template”, which defaults to ‘calendar-
   month.php’ when left out.
 * It would be great if you would think about integrating this changes into your
   plugin.
 * Thank you
 * Dieter
 * PS: If you are interested, i can send you my calendar-list.php template file.

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

 *  Plugin Author [Room 34 Creative Services, LLC](https://wordpress.org/support/users/room34/)
 * (@room34)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/adding-multiple-template-support/#post-10707601)
 * Thanks for this suggestion! I’m making some updates to the plugin and will be
   including some configurable options including different view templates in a future
   version.
 * There’s a new version out today that includes some bug fixes and enhancements.
   You’ll want to be sure to copy in your enhancements when you update.
 * Thanks!
 *  [cragmonkey](https://wordpress.org/support/users/cragmonkey/)
 * (@cragmonkey)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/adding-multiple-template-support/#post-11031150)
 * I had the same challenge, and was forced to modify ics-calendar.php to achieve
   it. Here what I came up with:
 *     ```
       // Render template
       $template_dir = $args['template_dir']??(dirname(__FILE__).'/templates/';
       switch (@$args['view']) {
            case 'list':
                 include($template_dir  . 'calendar-list.php');
                 break;
            case 'month':         
                 include($template_dir  . 'calendar-month.php');
                 break;
            default:
                 $try_file = $template_dir  . 'calendar-'.$args['view'].'.php';
                 if(!empty($args['view']) && file_exists($try_file)){
                      include($try_file);
                 }else{
                      include($template_dir  . 'calendar-month.php');
                 }
                 break;
       }
       ```
   
 * (Note that this version also allows for template directories to exist outside
   of the plugin’s directory so that the contents of the plugin’s directory can 
   remain unmodified.)
 *  Plugin Author [Room 34 Creative Services, LLC](https://wordpress.org/support/users/room34/)
 * (@room34)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/adding-multiple-template-support/#post-11032676)
 * That’s a good idea. What type of view were you using this to add? (I’m trying
   to gauge interest in adding more views besides Month and List.)
 *  [cragmonkey](https://wordpress.org/support/users/cragmonkey/)
 * (@cragmonkey)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/adding-multiple-template-support/#post-11039091)
 * I created a few variations of a free/busy calendar, where the colors of the days
   change depending on the all-day events (used for displaying availability of a
   vacation rental). One view is tiny and contains no text (just color codes) suitable
   for placing in a sidebar, two views show each month in a single row (one tiny
   and one larger and contains text), and one “normal” calendar. On each, additional
   rows are added to each week for each distinct event location. This allows me 
   to cleanly display information from one or more rental properties on the same
   calendar.
 * Incidentally, I also tweaked the js so that a configurable number of months can
   be displayed at a time and they update correctly when a new month is selected
   from the dropdown.
    -  This reply was modified 7 years, 4 months ago by [cragmonkey](https://wordpress.org/support/users/cragmonkey/).
 *  Plugin Author [Room 34 Creative Services, LLC](https://wordpress.org/support/users/room34/)
 * (@room34)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/adding-multiple-template-support/#post-11048937)
 * Thanks… those are great examples! I’m finding this plugin is being used for things
   I never would have imagined when I created it.
 * I don’t have a ton of time at the moment to do much new development on this since
   it’s not bringing in any money (though I’m considering creating a paid “Pro” 
   version so I can devote more time to it), but I’ll look at incorporating better
   support for creating customized templates like what you’re doing here.

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

The topic ‘Adding multiple template support’ is closed to new replies.

 * ![](https://ps.w.org/ics-calendar/assets/icon.svg?rev=3427980)
 * [ICS Calendar](https://wordpress.org/plugins/ics-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ics-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ics-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/ics-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ics-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ics-calendar/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Room 34 Creative Services, LLC](https://wordpress.org/support/users/room34/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/adding-multiple-template-support/#post-11048937)
 * Status: resolved