WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#7477 closed enhancement (wontfix)

Add single-ID.php to template hirearchy

Reported by: isaacchapman Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Template Keywords:
Focuses: Cc:

Description

This might some people to go a bit over the top in regards to customizing how each individual post is displayed, but why not add a single-ID.php (where ID is the Post's ID) to the template hierarchy in a similar manner as the category template hierarchy?

The following replacement for the get_single_template() function in /wp-includes/theme.php also includes an apply_filters('single_template') for why not reasons:

function get_single_template() {
	global $post;
	$template = '';
	if ( $post && $post->ID && file_exists(TEMPLATEPATH . "/single-" . $post->ID . '.php') )
		$template = TEMPLATEPATH . "/single-" . $post->ID . '.php';
	else 
		$template = get_query_template('single');

	return apply_filters('single_template', $template);
}

Change History (2)

comment:1 @isaacchapman7 years ago

  • Type changed from defect to enhancement

comment:2 @markjaquith7 years ago

  • Milestone 2.7 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

why not add a single-ID.php

A better question to ask is "why?" If every "why not?" feature was added, we'd be drowning in code bloat. Is there a specific need for this? It seems highly unlikely that people are going to create custom templates for posts. Are they supposed to know the post ID ahead of time? Or is this for creating specific templates for old posts? Why? Pages are more likely to require a specific template, but we already have the Page Templates feature handling that.

Note: See TracTickets for help on using tickets.