lp__get_template_part( $slug, $name = null, $load = true, $require_once = false, $args = array(), $plugin_name = LP__NAME )

The lp__get_template_part function is used to retrieve or load a plugin template. It allows you to specify a template slug and name and then attempts to locate and load the corresponding template file. The function uses the lp__get_template_path function to locate the template file within the theme directory first and then within the plugin directory if it’s not found.

Plugin

Namespace

Launchpad

Parameters

array

$args

Template arguments to pass.

bool

$load

Whether to load the template.

bool

$require_once

Whether to load the template once.

string

$slug

Template slug.

string

$name

Template name (optional).

string

$plugin_name

Plugin name to get the file from.

Return

void

Source

File: \includes\lp-utility-functions.php

function lp__get_template_part( $slug, $name = null, $load = true, $require_once = false, $args = array(), $plugin_name = LP__NAME ){

    $templates = array();
    if (isset($name)) $templates[] = "{$slug}-{$name}.php";
    
    $templates[] = "{$slug}.php";
    
    // Locate template path and load
    lp__get_template_path( $templates, $load, $require_once, $args, $plugin_name );

}

Related

Used to standardize file paths by replacing backslashes and removing duplicates.

Used to retrieve the normalized file path of a plugin file.

Used to include Launchpad plugin files via require_once based on filename and plugin name.

Use to search for template files in theme and plugin directories.

Use to load multiple template parts based on slugs and names.

Use to load multiple template parts based on slugs and names.