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

I have a custom post type called debate and I want to create some custom fields just on this post type. So, I have this code:

function debate_comment_fields( $fields ) {

   if( is_singular( 'debate' ) ) {


    $fields['options'] = '<p class="comment-form-options"><label for="options">' . __( 'I want to' ) . '</label>' .
        '<input id="first" name="category" type="radio" value="' . get_post_meta(get_the_ID(), 'agree', true) .'" />'. 
        '<input id="second" name="category" type="radio" value="' . get_post_meta(get_the_ID(), 'disagree', true) .'" /></p>';

         return $fields;


Everything is ok on my custom post type, but on the default blog post type the author,email and url are not displayed.

Any idea why?

share|improve this question
up vote 2 down vote accepted

Yes, alter the single-debate.php and call a custom comment template using comment_template with a parameter, representing your custom comment template.

// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() )
share|improve this answer
thanks for this, but is not relevant for what I'm asking for... – agis Oct 31 '13 at 16:48
in functions.php the line if( is_singular( 'debate' ) ) { does not make sense. its only for the template that you are viewing seeis_singular. first register the custom fields in functions php. then show them in the template. – user9 Oct 31 '13 at 18:11
ok, do you have any suggestion on how can I make this work just on that specific post type ? – agis Oct 31 '13 at 18:13
why not check out the plugin above, it seems that would be easiest. i can not test it now unfortunately. but there are many tutorials, see maybe this thread – user9 Oct 31 '13 at 18:17
I don't think you understand exactly what I need. That thread is about something else, the plugin is also about something different. All I need is just a function,conditional to display those custom comment fields on a specific custom type which is already created. – agis Oct 31 '13 at 18:44

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.