get_template_part


get_template_part ( $slug, $name = null, $args = array() )

Parameters:
  • (string) slug The slug name for the generic template.
  • (string) name The name of the specialised template.
  • (array) args Optional. Additional arguments passed to the template. Default empty array.
Returns:
  • (void|bool) Void on success, false if the template does not exist.
Defined at:
Change Log:
  • 5: .
  • 5: .

Description

Loads a template part into a template.Provides a simple mechanism for child themes to overload reusable sections of code in the theme. Includes the named template part for a theme or if a name is specified then a specialised part will be included. If the theme contains no {slug}.php file then no template will be included. The template is included using require, not require_once, so you may include the same template part multiple times. For the $name parameter, if the file is called "{slug}-special.php" then specify "special".

Related Functions

get_template, get_template_directory, get_tag_template, get_404_template, get_theme_file_path

Top Google Results

User discussions

wpseek mobile