In the theme’s comment.php file, I’m modifying the $args parameter that will be passed to comment_form();
Specifically, I want to add text to comment_notes_before. Thus my $arg looks like this
$comments_args = array('comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . 'See our privacy statement</p>');
This raises an “Undefined variable: required_text“
Of course I can hardcode the text, but that feels to me more like a hack. I guess this is really a php question. Is there something else I need to include in my code to expose the $required_text variable? Or is it never accessible?
Or, is it possible to append to the default rather than replacing the default text?
Thank you.
The topic ‘$required_text undefined’ is closed to new replies.
(@karl53)
10 years, 7 months ago
A real newbie question here.
In the theme’s comment.php file, I’m modifying the $args parameter that will be passed to comment_form();
Specifically, I want to add text to
comment_notes_before. Thus my $arg looks like this$comments_args = array('comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . 'See our privacy statement</p>');This raises an “Undefined variable: required_text“
Of course I can hardcode the text, but that feels to me more like a hack. I guess this is really a php question. Is there something else I need to include in my code to expose the
$required_textvariable? Or is it never accessible?Or, is it possible to append to the default rather than replacing the default text?
Thank you.