app/libraries/Jentil/Utilities/Loader.php
private function load(string $type, string $slug, string $name = ''): string
    {
        $slug = \ltrim($slug, '/');
        $slug = \rtrim($slug, '.php');

        $this->doAction($type, $slug, $name);

        $slug = $this->rewriteSlug($type, $slug);
        $rel_dir = $this->utilities->fileSystem->relativeDir();

        $templates = [];

        if ($name) {
            $templates[] = "{$slug}-{$name}.php";

            if ($rel_dir) {
                $templates[] = "{$rel_dir}/{$slug}-{$name}.php";
            }
        }

        $templates[] = "{$slug}.php";

        if ($rel_dir) {
            $templates[] = "{$rel_dir}/{$slug}.php";
        }

        return \locate_template($templates, true, false);
    }
private function load(string $type, string $slug, string $name = ''): string
    {
        $slug = \ltrim($slug, '/');
        $slug = \rtrim($slug, '.php');

        $this->doAction($type, $slug, $name);

        $slug = $this->rewriteSlug($type, $slug);
        $rel_dir = $this->utilities->fileSystem->relativeDir();

        $templates = [];

        if ($name) {
            $templates[] = "{$slug}-{$name}.php";

            if ($rel_dir) {
                $templates[] = "{$rel_dir}/{$slug}-{$name}.php";
            }
        }

        $templates[] = "{$slug}.php";

        if ($rel_dir) {
            $templates[] = "{$rel_dir}/{$slug}.php";
        }

        return \locate_template($templates, true, false);
    }
private function load ( string $ type , string $ slug , string $ name = '' ) : string { $ slug = \ ltrim ( $ slug , '/' ) ; $ slug = \ rtrim ( $ slug , '.php' ) ; $ this -> doAction ( $ type , $ slug , $ name ) ; $ slug = $ this -> rewriteSlug ( $ type , $ slug ) ; $ rel_dir = $ this -> utilities -> fileSystem -> relativeDir ( ) ; $ templates = [ ] ; if ( $ name ) { $ templates [ ] = "{$slug}-{$name}.php" ; if ( $ rel_dir ) { $ templates [ ] = "{$rel_dir}/{$slug}-{$name}.php" ; } } $ templates [ ] = "{$slug}.php" ; if ( $ rel_dir ) { $ templates [ ] = "{$rel_dir}/{$slug}.php" ; } return \ locate_template ( $ templates , true , false ) ; }
Helper to load partial or template

This mimics WordPress' `\get_template_part()` function.

@see
https://developer.wordpress.org/reference/functions/get_template_part/

@param string $type 'template' or 'partial'
Helper to load partial or template