Retrieves a registered template by its slug.
Parameters
$template_slug
stringrequired- Slug of the template.
Source
public function get_by_slug( $template_slug ) {
$all_templates = $this->get_all_registered();
if ( ! $all_templates ) {
return null;
}
foreach ( $all_templates as $template ) {
if ( $template->slug === $template_slug ) {
return $template;
}
}
return null;
}
Changelog
Version | Description |
---|---|
6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.