source/php/Helper/Wp.php
public static function getTemplate($prefix = '', $slug = '', $error = true)
    {
        $paths = apply_filters('Modularity/Module/TemplatePath', array(
            get_stylesheet_directory() . '/templates/',
            get_template_directory() . '/templates/',
            MODULARITY_PATH . 'templates/',
        ));

        $slug = apply_filters('Modularity/TemplatePathSlug', $slug ? $slug . '/' : '', $prefix);
        $prefix = $prefix ? '-'.$prefix : '';

        foreach ($paths as $path) {
            $file = $path . $slug . 'modularity' . $prefix.'.php';

            if (file_exists($file)) {
                return $file;
            }
        }

        if (defined('WP_DEBUG') && WP_DEBUG === true) {
            error_log('Modularity: Template ' . $slug . 'modularity' . $prefix . '.php' . ' not found in any of the paths: ' . var_export($paths, true));
            if ($error) {
                trigger_error('Modularity: Template ' . $slug . 'modularity' . $prefix . '.php' . ' not found in any of the paths: ' . var_export($paths, true), E_USER_WARNING);
            }
        }
    }
public static function getTemplate($prefix = '', $slug = '', $error = true)
    {
        $paths = apply_filters('Modularity/Module/TemplatePath', array(
            get_stylesheet_directory() . '/templates/',
            get_template_directory() . '/templates/',
            MODULARITY_PATH . 'templates/',
        ));

        $slug = apply_filters('Modularity/TemplatePathSlug', $slug ? $slug . '/' : '', $prefix);
        $prefix = $prefix ? '-'.$prefix : '';

        foreach ($paths as $path) {
            $file = $path . $slug . 'modularity' . $prefix.'.php';

            if (file_exists($file)) {
                return $file;
            }
        }

        if (defined('WP_DEBUG') && WP_DEBUG === true) {
            error_log('Modularity: Template ' . $slug . 'modularity' . $prefix . '.php' . ' not found in any of the paths: ' . var_export($paths, true));
            if ($error) {
                trigger_error('Modularity: Template ' . $slug . 'modularity' . $prefix . '.php' . ' not found in any of the paths: ' . var_export($paths, true), E_USER_WARNING);
            }
        }
    }
public static function getTemplate ( $ prefix = '' , $ slug = '' , $ error = true ) { $ paths = apply_filters ( 'Modularity/Module/TemplatePath' , array ( get_stylesheet_directory ( ) . '/templates/' , get_template_directory ( ) . '/templates/' , MODULARITY_PATH . 'templates/' , ) ) ; $ slug = apply_filters ( 'Modularity/TemplatePathSlug' , $ slug ? $ slug . '/' : '' , $ prefix ) ; $ prefix = $ prefix ? '-' . $ prefix : '' ; foreach ( $ paths as $ path ) { $ file = $ path . $ slug . 'modularity' . $ prefix . '.php' ; if ( file_exists ( $ file ) ) { return $ file ; } } if ( defined ( 'WP_DEBUG' ) && WP_DEBUG === true ) { error_log ( 'Modularity: Template ' . $ slug . 'modularity' . $ prefix . '.php' . ' not found in any of the paths: ' . var_export ( $ paths , true ) ) ; if ( $ error ) { trigger_error ( 'Modularity: Template ' . $ slug . 'modularity' . $ prefix . '.php' . ' not found in any of the paths: ' . var_export ( $ paths , true ) , E_USER_WARNING ) ; } } }
Tries to get the template path
Checks the plugin's template folder, the parent theme's templates folder and the current theme's template folder
@param  string  $prefix The filename without prefix
@param  string  $slug   The directory
@param  boolean $error  Show errors or not
@return string          The path to the template to use
Tries to get the template path Checks the plugin s template folder the parent theme s templates folder and the current theme s template folder