WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding text after comment box and before "post comment" button (8 posts)

  1. flaviaborges
    Member
    Posted 2 years ago #

    I'm a total newbie using a twentyten child theme and need to figure out how to add a few lines of text between the comment box and the "post comment" button as seen here http://www.younghouselove.com/2011/11/nursery-art-expansion/#comments. I've looked everywhere for an answer and haven't found anything so apologize if this question has been answered before. I used this code '.form-allowed-tags {display: none;' on my css style sheet to hide the default text "You may use HTML tags and attributes", but now I've got to find a away to add my own text there instead. Any help would be very welcome!

  2. wspencer
    Member
    Posted 2 years ago #

    You can edit your comments.php file and add lines of text where you want it.

    Look for something similar to this in the code....

    <textarea name="comment"......

    That is the actual text box where people leave their comment.

    Look for something similar to this in the code then.....

    <input type="submit"....

    That is where the actual button for posting the comment is.

    Feel free to add whatever HTML in between those items as you'd like.

    Hope that helps you out!

  3. flaviaborges
    Member
    Posted 2 years ago #

    I tried it but there's nothing that looks even similar to that in my commemnts.php file. I did a bit of error and trial and realized this:

    <?php comment_form (); ?>

    corresponds to the whole "comment form", which contains both the where people leave their comment and the actual button for posting the comment. I guess I need to add my text in between there somewhere but don't know exactly how. Or I could be totally wrong since I don't know anything about coding. Any ideas? Thanks for helping

  4. wspencer
    Member
    Posted 2 years ago #

    You'll want to pass some $args to the comment_form() function, specifically the one for comment_notes_after, which controls what is displayed after the fields but before the submit button. By default, this is what your comment_notes_after is....

    '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>'

    Try editing your comments.php file where it calls the comments_form() to include something like this....

    <?php $args = array('comment_notes_after' => 'Here is where your custom text goes, HTML formatting and all!'); ?>
    
    <?php comment_form( $args ); ?>

    Hopefully that helps you out!

  5. flaviaborges
    Member
    Posted 2 years ago #

    That works perfectly! Thank you so much for your answer! Now, any idea on how I can edit the font size and text width for the text I entered on my style.css?

  6. wspencer
    Member
    Posted 2 years ago #

    Just create a style in your CSS and assign it in your code....

    Example....

    In your CSS, create a class for your comments
    
    .custom_comments { font-size: 12px; font-style: italic; font-weight: bold; color: #000000; }
    
    Then in your code from above, do this.
    
    <?php $args = array('comment_notes_after' => '<p class='custom_comments'>Here is where your custom text goes, HTML formatting and all!</p>'); ?>
    
    <?php comment_form( $args ); ?>

    Of course, put in the CSS whatever styling you want and in your comments.php, you can assign that class using a <p> tag or even a <span> tag

  7. flaviaborges
    Member
    Posted 2 years ago #

    Thank you so much! this was extremely helpful!

  8. wspencer
    Member
    Posted 2 years ago #

    No problem! Please be sure to mark this topic as Resolved. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic