Example #1
0
function epl_load_core_templates($template)
{
    global $epl_settings;
    $template_path = epl_get_content_path();
    if (isset($epl_settings['epl_feeling_lucky']) && $epl_settings['epl_feeling_lucky'] == 'on') {
        return $template;
    }
    $post_tpl = '';
    if (is_epl_post_single()) {
        $common_tpl = apply_filters('epl_common_single_template', 'single-listing.php');
        $post_tpl = 'single-' . str_Replace('_', '-', get_post_type()) . '.php';
        $find[] = $post_tpl;
        $find[] = epl_template_path() . $post_tpl;
        $find[] = $common_tpl;
        $find[] = epl_template_path() . $common_tpl;
    } elseif (is_epl_post_archive()) {
        $common_tpl = apply_filters('epl_common_archive_template', 'archive-listing.php');
        $post_tpl = 'archive-' . str_Replace('_', '-', get_post_type()) . '.php';
        $find[] = $post_tpl;
        $find[] = epl_template_path() . $post_tpl;
        $find[] = $common_tpl;
        $find[] = epl_template_path() . $common_tpl;
    } elseif (is_tax('location') || is_tax('tax_feature')) {
        $term = get_queried_object();
        $common_tpl = apply_filters('epl_common_taxonomy_template', 'archive-listing.php');
        $post_tpl = 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[] = epl_template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[] = 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = epl_template_path() . 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = $common_tpl;
        $find[] = $post_tpl;
        $find[] = epl_template_path() . $common_tpl;
    }
    if ($post_tpl) {
        $template = locate_template(array_unique($find));
        if (!$template) {
            $template = $template_path . $common_tpl;
        }
    }
    return $template;
}
function epl_get_template_part($template, $arguments = array())
{
    $base_path = epl_get_content_path();
    $default = $template;
    $find[] = epl_template_path() . $template;
    $template = locate_template(array_unique($find));
    if (!$template) {
        $template = $base_path . $default;
        if (!file_exists($template)) {
            //fallback to core
            $base_path = epl_get_fallback_content_path();
            $template = $base_path . $default;
        }
    }
    if (!isset($arguments['epl_author'])) {
        global $epl_author;
    }
    extract($arguments);
    include $template;
}