Codex

Function Reference/load template

Contents

Description

Require once the template file with WordPress environment.

The globals are set up for the template file to ensure that the WordPress environment is available from within the function. The query variables are also available.

Usage

<?php load_template$_template_file ?>

Parameters

$_template_file
(string) (required) Path to template file.
Default: None

Return Values

(void) 
This function does not return a value.

Examples

Notes

  • Uses global: (object) $wp_query to extract extract() global variables returned by the query_vars method while protecting the current values in these global variables:
    • (unknown type) $posts
    • (unknown type) $post
    • (boolean) $wp_did_header Returns true if the WordPress header was already loaded. See the /wp-blog-header.php file for details.
    • (boolean) $wp_did_template_redirect
    • (object) $wp_rewrite
    • (object) $wpdb
    • (string) $wp_version holds the installed WordPress version number.
    • (string) $wp
    • (string) $id
    • (string) $comment
    • (string) $user_ID

Change Log

Since: 1.5.0

Source File

load_template() is located in wp-includes/theme.php.

Related

See also index of Function Reference and index of Template Tags.