What is a Single?

When using WordPress, what is meant by the term single or singular and how do you use them?

A single post [type]

A single is a singular page or post, including custom post type.

Within the single’s file, you don’t need to set any custom query, as it’s set as default, in order to pull in data from the current post.

Single's template hierarchy

  • single.php – matches all singles, regardless of the post type.
  • single-{post-type}.php – matches all singles of a specific post type, overriding the default fallback of single.php.

Detecting singles

Outside the loop, a single can be detected as if ( is_singe() ) {} or if ( is_singular( ‘post-type’ ) ) {} if you’re trying to dedect a specific type.