/** * Load a template. * * Handles template usage so that we can use our own templates instead of the themes. * * Templates are in the 'templates' folder. eventon looks for theme * overrides in /theme/eventon/ by default * * For beginners, it also looks for a eventon.php template first. If the user adds * this to the theme (containing a eventon() inside) this will be used for all * eventon templates. * * @access public * @param mixed $template * @return string */ public function template_loader($template) { global $eventon_sin_event, $eventon; $file = ''; $sure_path = AJDE_EVCAL_PATH . '/templates/'; // Paths to check $paths = apply_filters('eventon_template_paths', array(0 => TEMPLATEPATH . '/', 1 => TEMPLATEPATH . '/' . $eventon->template_url)); $evOpt = evo_get_options('1'); $events_page_id = evo_get_event_page_id($evOpt); // single and archieve events page if (is_single() && get_post_type() == 'ajde_events') { $file = 'single-ajde_events.php'; // if this page is event archive page } elseif (is_post_type_archive('ajde_events')) { $file__ = evo_get_event_template($evOpt); $file = $file__; $paths[] = $file__ == 'archive-ajde_events.php' ? AJDE_EVCAL_PATH . '/templates/' : get_template_directory(); } // FILE Exist if ($file) { // each path foreach ($paths as $path) { if (file_exists($path . $file)) { $template = $path . $file; break; } } if (!$template) { $template = AJDE_EVCAL_PATH . '/templates/' . $file; } } //print_r($template); return $template; }
public function template_loader($template) { global $eventon_sin_event, $eventon; $file = ''; $sure_path = AJDE_EVCAL_PATH . '/templates/'; // get child theme path incase user is using child theme $childThemePath = get_stylesheet_directory(); // Paths to check $paths = apply_filters('eventon_template_paths', array(0 => TEMPLATEPATH . '/', 1 => TEMPLATEPATH . '/' . $eventon->template_url, 2 => $childThemePath . '/', 3 => $childThemePath . '/' . $eventon->template_url)); $evOpt = evo_get_options('1'); $events_page_id = evo_get_event_page_id($evOpt); // single and archive events page if (is_single() && get_post_type() == 'ajde_events') { include_once 'class-single-event.php'; $paths[] = AJDE_EVCAL_PATH . '/templates/'; $file = 'single-ajde_events.php'; // if this page is event archive page } elseif (is_post_type_archive('ajde_events')) { $file__ = evo_get_event_template($evOpt); $file = $file__; $paths[] = $file__ == 'archive-ajde_events.php' ? AJDE_EVCAL_PATH . '/templates/' : get_template_directory(); } elseif (is_tax(array('event_type', 'event_type_2', 'event_type_3', 'event_type_4', 'event_type_5'))) { $file = 'taxonomy-event_type.php'; $paths[] = AJDE_EVCAL_PATH . '/templates/'; } elseif (is_tax(array('event_location'))) { $file = 'taxonomy-event_location.php'; $paths[] = AJDE_EVCAL_PATH . '/templates/'; } elseif (is_tax(array('event_organizer'))) { $file = 'taxonomy-event_organizer.php'; $paths[] = AJDE_EVCAL_PATH . '/templates/'; } // FILE Exist if ($file) { // each path foreach ($paths as $path) { //echo $path.$file.'<br/>'; if (file_exists($path . $file)) { $template = $path . $file; break; } } if (!$template) { $template = AJDE_EVCAL_PATH . '/templates/' . $file; } } //print_r($template); return $template; }
<?php /* * The template for displaying events calendar on "/events" url slug * * Override this template by coping it to yourtheme/eventon/archive-ajde_events.php * * @Author: AJDE * @EventON * @version: 0.1 */ get_header(); $evOpt = evo_get_options('1'); $archive_page_id = evo_get_event_page_id($evOpt); // check whether archieve post id passed if ($archive_page_id) { $archive_page = get_page($archive_page_id); echo "<div class='wrapper'>"; echo apply_filters('the_content', $archive_page->post_content); echo "</div>"; } else { echo "<p>ERROR: Please select a event archive page in eventON Settings > Events Paging > Select Events Page</p>"; } get_footer();