Switch language

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




get_tag_template [ WordPress Function ]

get_tag_template ( No parameters )
Uses:
Returns:
  • (string)
Defined at:



Retrieve path of tag template in current or parent template.

Works by first retrieving the current tag name, for example 'tag-wordpress.php' and then trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php template, if those files don't exist.

Source


<?php
function get_tag_template() {
    
$tag get_queried_object();

    
$templates = array();

    
$templates[] = "tag-{$tag->slug}.php";
    
$templates[] = "tag-{$tag->term_id}.php";
    
$templates[] = 'tag.php';

    return 
get_query_template'tag'$templates );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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