WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to enable a second content area in the edit screen if a certain template is chosen?

I have seen plugins like the second section plugin but that enables it for all pages I would like to only have the second section if a certain page template is chosen for a page.

share|improve this question
up vote 2 down vote accepted

You could add a metabox for your second content section, then hide it with a bit of javascript if the current template isn't a specific template:

current_template = jQuery('#page_template').val();
if( current_template != 'my-special-template.php' ){

then bind a function to the change event of the template dropdown and show it when a specific template is selected:

    selected_template = jQuery(this).val();
    if( selected_template == 'my-special-template.php' ){
share|improve this answer
Thanks that is a nice idea, my only concern would be users without JavaScript on. – Lee Sep 9 '11 at 8:05
@Lee - without javascript the only way to do it would be to require that they select a template then save the post before they're able to see the additional content section. the visual editor doesn't work and there's no way to add images to a post without js anyway. – Milo Sep 9 '11 at 14:46
|Good point I will try it out and see how I get on - thanks :) – Lee Sep 9 '11 at 15:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.