Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




is_page_template [ WordPress Function ]

is_page_template ( $template = '' )
Parameters:
  • (string) $template The specific template name if specific matching is required.
Uses:
  • $wp_query
Returns:
  • (bool) False on failure, true if success.
Defined at:



Whether currently in a page template.

This template tag allows you to determine if you are in a page template. You can optionally provide a template name and then the check will be specific to that template.

Source


<?php
function is_page_template$template '' ) {
    if ( ! 
is_page() )
        return 
false;

    
$page_template get_page_template_slugget_queried_object_id() );

    if ( empty( 
$template ) )
        return (bool) 
$page_template;

    if ( 
$template == $page_template )
        return 
true;

    if ( 
'default' == $template && ! $page_template )
        return 
true;

    return 
false;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics