Action
get_template_part_{$slug}
On this page
Fires before a RestroPress template part is located.
Runs at the start of rpress_get_template_part(), before the template file is resolved. The hook name is built from the slug, for example get_template_part_list/fooditems. The same name pattern is also used by WordPress core's get_template_part(), which passes different arguments.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$slug | string | Template slug. |
$name | string|null | Template name, or null. |
Example#
function my_before_fooditems_part( $slug, $name ) {
echo '<!-- loading ' . esc_html( $slug ) . ' -->';
}
add_action( 'get_template_part_list/fooditems', 'my_before_fooditems_part', 10, 2 );
Notes#
The hook name depends on the slug passed to rpress_get_template_part(), for example list/fooditems or grid/fooditems.
Source#
Fired from:
includes/template-functions.php(line 610), inrpress_get_template_part()
See also#
Was this page helpful?
