WordPress.org

Forums

[resolved] php comment_form. Where do I place the code to remove a field? (6 posts)

  1. hellodrifter
    Member
    Posted 4 years ago #

    http://codex.wordpress.org/Function_Reference/comment_form

    The codex provides so many clear examples, but where on Earth is all this code being placed? :(

    I have read this resource and a number of tutorials, but the one bit of information I just can't seem to figure out is WHERE I place all this code that makes all the changes I need to customize my comments form.

    The codex talks about the $args array and using the comment_form_default_fields filter to make changes.

    Is all the various code inside the parenthesis of the comment_form function? Outside the parenthesis? Are filters placed inside functions.php, or is it the comments.php all this code should be placed in?

    If someone could please point out where this code should go to customize the <?php comment_form(); ?> function I'm sure I can figure most of this out on my own.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    where on Earth is all this code being placed?

    The comment form arguments & fields are normally within your theme's functions.php file.

  3. hellodrifter
    Member
    Posted 4 years ago #

    Thank you esmi, I will move forward coding on that basis and post my results.

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    If you want to look at an example, download a copy of the ZenLite theme and check out the functions.php file.

  5. hellodrifter
    Member
    Posted 4 years ago #

    Thx again esmi, my comment form is coming along great. I found your functions file very helpful in figuring out php syntax and writing my code. When I place the comment_args array and filters inside functions.php, the default form appears in my single post view. But the array works just fine when I place the it above the comment_form function in comments.php. Is there a downside to keeping the array in comments.php rather than functions.php?

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    Not really. It's simply good practice to keep all of your functions in functions.php - especially if others are going to use your theme.

Topic Closed

This topic has been closed to new replies.

About this Topic