get_single_template


get_single_template ( No parameters )

See:
Returns:
  • (string) Full path to single template file.
Defined at:
Change Log:
  • 4: .
  • 4: .
  • 4: .

Description

Retrieve path of single template in current or parent template. Applies to single Posts, single Attachments, and single custom post types.

The hierarchy for this template looks like:

  1. {Post Type Template}.php
  2. single-{post_type}-{post_name}.php
  3. single-{post_type}.php
  4. single.php

An example of this is:

  1. templates/full-width.php
  2. single-post-hello-world.php
  3. single-post.php
  4. single.php

The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where $type is 'single'.

Related Functions

get_singular_template, get_index_template, get_page_template, get_page_templates, get_paged_template

Top Google Results

User discussions

wpseek mobile