library/Template.php
public function load($template)
    {
        if ((is_page() || is_single() || is_front_page()) && !empty(get_page_template_slug()) && get_page_template_slug() != $template) {
            if (\Municipio\Helper\Template::locateTemplate(get_page_template_slug())) {
                $template = get_page_template_slug();
            }
        }

        if (!\Municipio\Helper\Template::isBlade($template)) {
            $path = $template;

            // Return path if file exists, else default to page.blade.php
            if (file_exists($path)) {
                return $path;
            } else {
                if (current_user_can('administrator')) {
                    \Municipio\Helper\Notice::add('<strong>' . __('Admin notice', 'municipio') . ':</strong> ' . sprintf(__('View [%s] was not found. Defaulting to [page.blade.php].', 'municipio'), $template), 'warning', 'pricon pricon-notice-warning');
                }

                $template = \Municipio\Helper\Template::locateTemplate('views/page.blade.php');
            }
        }

        // Clean the view path
        $view = $this->cleanViewPath($template);

        // Load view controller
        $controller = $this->loadController($view);

        // Render the view
        $data = null;
        if ($controller) {
            $data = $controller->getData();
        }

        $this->render($view, $data);

        return false;
    }
public function load($template)
    {
        if ((is_page() || is_single() || is_front_page()) && !empty(get_page_template_slug()) && get_page_template_slug() != $template) {
            if (\Municipio\Helper\Template::locateTemplate(get_page_template_slug())) {
                $template = get_page_template_slug();
            }
        }

        if (!\Municipio\Helper\Template::isBlade($template)) {
            $path = $template;

            // Return path if file exists, else default to page.blade.php
            if (file_exists($path)) {
                return $path;
            } else {
                if (current_user_can('administrator')) {
                    \Municipio\Helper\Notice::add('<strong>' . __('Admin notice', 'municipio') . ':</strong> ' . sprintf(__('View [%s] was not found. Defaulting to [page.blade.php].', 'municipio'), $template), 'warning', 'pricon pricon-notice-warning');
                }

                $template = \Municipio\Helper\Template::locateTemplate('views/page.blade.php');
            }
        }

        // Clean the view path
        $view = $this->cleanViewPath($template);

        // Load view controller
        $controller = $this->loadController($view);

        // Render the view
        $data = null;
        if ($controller) {
            $data = $controller->getData();
        }

        $this->render($view, $data);

        return false;
    }
public function load ( $ template ) { if ( ( is_page ( ) || is_single ( ) || is_front_page ( ) ) && ! empty ( get_page_template_slug ( ) ) && get_page_template_slug ( ) != $ template ) { if ( \ Municipio \ Helper \ Template :: locateTemplate ( get_page_template_slug ( ) ) ) { $ template = get_page_template_slug ( ) ; } } if ( ! \ Municipio \ Helper \ Template :: isBlade ( $ template ) ) { $ path = $ template ; // Return path if file exists, else default to page.blade.php if ( file_exists ( $ path ) ) { return $ path ; } else { if ( current_user_can ( 'administrator' ) ) { \ Municipio \ Helper \ Notice :: add ( '<strong>' . __ ( 'Admin notice' , 'municipio' ) . ':</strong> ' . sprintf ( __ ( 'View [%s] was not found. Defaulting to [page.blade.php].' , 'municipio' ) , $ template ) , 'warning' , 'pricon pricon-notice-warning' ) ; } $ template = \ Municipio \ Helper \ Template :: locateTemplate ( 'views/page.blade.php' ) ; } } // Clean the view path $ view = $ this -> cleanViewPath ( $ template ) ; // Load view controller $ controller = $ this -> loadController ( $ view ) ; // Render the view $ data = null ; if ( $ controller ) { $ data = $ controller -> getData ( ) ; } $ this -> render ( $ view , $ data ) ; return false ; }
Load controller and view
@param  string $template Template
@return mixed            Exception or false, false to make sure no
standard template file from wordpres is beeing included
Load controller and view