Make WordPress Core

Opened 10 years ago

Closed 6 years ago

#7103 closed enhancement (wontfix)

Post Template

Reported by: gmcosta Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7.1
Component: Administration Keywords: needs-patch
Focuses: Cc:


In the past few days I was trying to modify (with no success) the code of Wordpress Core to let users who has capability to write posts, to choose (in Write Post screen) what Post Template they want to use, like Wordpress already do with Pages.


To become included in the release feature list, this suggestion should be at least, very useful, so why am I proposing this?

Just an example. If you are using categories to classify books, the Book will be the post. You have to use custom fields to display some additional data, so you’ll have to prepare your single.php (unique post template) to display correctly this data.

In the same site you have to display pictures, movies, cars,etc… All of these data has it’s own group of custom fields.

Just imagine the hundreds of lines your single.php will have just to check what custom fields it should be displayed if you have 40 60 +100 categories associated with main cats: pictures, movies, cars...

I modified the follow files:

wp-includes/theme.php Line 440 - 461

wp-admin/includes/template.php Line 905 - 915

wp-admin/includes/theme.php Line 53 - 76

wp-admin/includes/post.php Line 206 / 226-227 / 330 / 406

wp-admin/edit-form-advanced.php Line 269-280

Like I'm not so familiar with wp core code and well know php dev I got some erros. The image I attached reproduce the Page Template in Write Post

I would like if someone give feedback. kind regards. Gmcosta

Attachments (2)

post-template.jpg (17.5 KB) - added by gmcosta 10 years ago.
Post Template Box
wp-post-skin.rar (1.4 KB) - added by Mrasnika 10 years ago.

Download all attachments as: .zip

Change History (16)

10 years ago

Post Template Box

#1 @gmcosta
10 years ago

  • Priority changed from low to normal
  • Severity changed from trivial to normal

I changed the code with success now. I don't know how to post a patch here, so I'll give the url of my new blog, that contains the post with what changes are needed to get this feature working on wordpress.

I still wait for feedback. Kind regards, Gmcosta.

#2 @gmcosta
10 years ago

ops. I forgot the address:


The link above it's a complete reference of what it should be done to get the feature working.

#3 @lloydbudd
10 years ago

  • Milestone changed from 2.6 to 2.7

Hi gmcosts, very interesting investigation. http://trac.wordpress.org/ has a section on how to submit a patch.

Your example seems forced. It wouldn't be a good scenario for this field. in such a scenario it seems that one would have access to the little bit of expertise needed to customize a theme to achieve it.

When looking at this type of WordPress behavior I assume it was by design. I assume that this was done on purpose and then consider why that would be. I wasn't around back then, but I don't think an additional field element on Write(/Edit) Post would be generally desirable and make WordPress better.

The question then might become is this possible as a plugin? Still, it seems very niche to do something like this on a per post level.

#4 @Mrasnika
10 years ago

Here's gmcosta's solution as a plugin. I tested it and it works fine w/ the 2 templates from the default (Kubrick) theme -- links.php and archives.php

#5 follow-up: @janeforshort
10 years ago

  • Milestone changed from 2.7 to 2.9

Interesting idea, would like to consider in context of later version, as we are working on some ideas around posts. In meantime, I second the idea of doing this as a plugin, which would also give us an idea of how many people would find it useful (enough for core).

#6 @Denis-de-Bernardy
9 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.9 to Future Release

+1 for post templates as well

#7 follow-up: @F J Kaiser
9 years ago

  • Version changed from 2.5.1 to 2.7.1

Post-Templates would be more than great.

#8 in reply to: ↑ 7 @Mrasnika
9 years ago

Replying to F J Kaiser:

Post-Templates would be more than great.

The latest is 2.8, why do you changed the version to 2.7.1 ?

#9 in reply to: ↑ 5 @JohnMyr
9 years ago

Replying to janeforshort:

I second the idea of doing this as a plugin, which would also give us an idea of how many people would find it useful (enough for core).

If in core it will be popular cause theme developers will pick up on it.

There are several plugin solutions available, and this should be a nice candidate as a canonical plugin imho. ( Matt talking about connecting plugin devs to make canonical plugins at WC SF. )

http://wordpress.org/extend/plugins/custom-post-template/ http://wordpress.org/extend/plugins/single-post-template/

#10 @WraithKenny
9 years ago

Could this be related to custom post types?

#11 @mikeschinkel
8 years ago

  • Cc mikeschinkel@… added

#12 @bainternet
7 years ago

  • Cc bainternet added

#13 @F J Kaiser
7 years ago

  • Cc 24-7@… added

#14 @jane
6 years ago

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

This is addressed by custom post types/taxonomies and/or post formats depending on the content in question. Closing as wontfix.

Note: See TracTickets for help on using tickets.