wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



get_page_template_slug › WordPress Function

Desde3.4.0
Obsoleton/a
get_page_template_slug ( $post = null )
Parâmetros:
  • (int|WP_Post) $post Optional. Post ID or WP_Post object. Default is global $post.
    Required: No
    Padrão: null
Retorna:
  • (string|false) Page template filename. Returns an empty string when the default page template is in use. Returns false if the post does not exist.
Definido em:
Codex:
Log de mudanças:
  • 4.7.0

Gets the specific template filename for a given post.



Fonte

function get_page_template_slug( $post = null ) {
	$post = get_post( $post );

	if ( ! $post ) {
		return false;
	}

	$template = get_post_meta( $post->ID, '_wp_page_template', true );

	if ( ! $template || 'default' === $template ) {
		return '';
	}

	return $template;
}