get_template_part_{$slug} WordPress Action Hook

The get_template_part_{$slug} hook allows you to include a template part into your WordPress site. This hook is used by passing the slug of the template part you want to include. The template part will be loaded from the theme's template directory.

do_action( "get_template_part_{$slug}", string $slug, string|null $name, array $args ) #

Fires before the specified template part file is loaded.


Description

The dynamic portion of the hook name, $slug, refers to the slug name for the generic template part.


Top ↑

Parameters

$slug

(string)The slug name for the generic template.

$name

(string|null)The name of the specialized template.

$args

(array)Additional arguments passed to the template.


Top ↑

Source

File: wp-includes/general-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.5.0The $args parameter was added.
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More