custom comments on specific post type

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' ) ) {

    unset($fields['url']);
     unset($fields['author']);
     unset($fields['email']);

    $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;

   }
  } 
add_filter('comment_form_default_fields','debate_comment_fields');  

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

Read More

Any idea why?

Related posts

1 comment

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

    <?php
    // If comments are open or we have at least one comment, load up the comment template
    if ( comments_open() || '0' != get_comments_number() )
        comments_template('custom-comments.php');
    ?>
    

Comments are closed.