wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
is_page_template › WordPress Function
Desde2.5.0
Obsoleton/a
› is_page_template ( $template = '' )
Parâmetros: |
|
Retorna: |
|
Definido em: |
|
Codex: | |
Log de mudanças: |
|
Determines whether the current post uses a page template.
This template tag allows you to determine if you are in a page template. You can optionally provide a template filename or array of template filenames and then the check will be specific to that template. For more information on this and similar theme functions, check out the {@link Conditional Tags} article in the Theme Developer Handbook.Funções relacionadas: get_page_template, get_paged_template, get_page_templates, get_template, get_page_template_slug
Fonte
function is_page_template( $template = '' ) { if ( ! is_singular() ) { return false; } $page_template = get_page_template_slug( get_queried_object_id() ); if ( empty( $template ) ) { return (bool) $page_template; } if ( $template == $page_template ) { return true; } if ( is_array( $template ) ) { if ( ( in_array( 'default', $template, true ) && ! $page_template ) || in_array( $page_template, $template, true ) ) { return true; } } return ( 'default' === $template && ! $page_template ); }