Cannot Remove Title Reply from Custom Comment Template for Signup Page
Building a page template, I've managed to remove all the fields I do not need. All except for the title reply and your email will not be published... text.
The general idea here is to use a custom version of the comment form where users can sign-up. The actual comments (emails) will not be shown on the page unless logged in as admin.
Code for the signup template:
?php if (post_password_required()) return;
$signup_args = array(
'label_submit' = __('Sign Up', 'theme')
);
comment_form($signup_args);
Code from my functions
file, modifying the comment template for this specific page:
add_filter( 'comment_form_fields', 'signup_page_comment_form_args' );
function signup_page_comment_form_args($fields){
if (is_page('signup')){
$signup_title_b = $fields['title_reply_before'];
$signup_title_a = $fields['title_reply_after'];
unset($fields['comment']);
unset($fields['title_reply_before']);
unset($fields['title_reply_after']);
unset($fields['author']);
unset($fields['url']);
unset($fields['cookies']);
}
return $fields;
}
But the title and the email text is still there PLUS I get a notice saying:
Notice: Undefined index: title_reply_before in /wp-content/themes/theme/functions.php on line 5
I'm stuck. Anyone?
Topic comment-form comments Wordpress
Category Web