This page redirects to an external site: https://developer.wordpress.org/reference/functions/load_template/
Languages: English • Italiano • (Add your language)
Richiede una volta il file del template con l'ambiente di WordPress.
Le variabili globali sono impostate per il file del template per garantire che l'ambiente di WordPress sia disponibile all'interno della funzione. Anche le variabili di query sono disponibili.
<code style="color: #000000"><span style="color: #0000BB"><?php load_template</span><span style="color: #007700">( </span><span style="color: #0000BB">$_template_file</span><span style="color: #007700">, </span><span style="color: #0000BB">$require_once </span><span style="color: #007700">) </span><span style="color: #0000BB">?></span></code>
if ( $overridden_template = locate_template( 'some-template.php' ) ) {
// locate_template() restituisce il percorso del file
// se il tema figlio o quello genitore hanno sovrascritto il template
load_template( $overridden_template );
} else {
// Se il tema figlio e quello genitore non hanno sovrascritto il template,
// viene caricato il template dalla sottocartella 'templates' che si trova nella cartella in cui
// si trova questo file
load_template( dirname( __FILE__ ) . '/templates/some-template.php' ); }
Da: 1.5.0
load_template() si trova in wp-includes/template.php.
Template Functions: locate_template(), load_template(), get_template(), get_template_part(), get_template_directory(), get_template_directory_uri(), get_page_templates(), comments_template(), get_query_template(), is_page_template()