This topic has 4 replies, 2 voices, and was last updated 7 years by Laura.

  • Author
  • #157865
     5high-photohub
    Participant

    Hi there,

    I’ve searched the forum with no results – only for comment form label changes – and would appreciate your help in getting some code to work for this.

    Aim: to reduce the height of the WP comments text input box. I’ve managed to move it to the top of the comments section but the text area box is too deep.

    I’ve found some info for this to go in my child theme functions.php but can’t make it work as I don’t think I’m using the correct ID’s and classes or fields.

    The code I found is here (https://wpsites.net/web-design/customize-comment-field-text-area-label/) and I’m going to adapt this part of it for the height, by reducing the rows=”8″ to rows=”1″:

    ‘function wpsites_modify_comment_form_text_area($arg) {
    $arg[‘comment_field’] = ‘<p class=”comment-form-comment”><label for=”comment”>’ . _x( ‘Your Feedback Is Appreciated’, ‘noun’ ) . ‘</label><textarea id=”comment” name=”comment” cols=”45″ rows=”1″ aria-required=”true”></textarea></p>’;
    return $arg;
    }

    add_filter(‘comment_form_defaults’, ‘wpsites_modify_comment_form_text_area’);’

    But when I try to check it with Firebug the fields are textarea, form-control and comment. So the textarea ID is correct and the name ‘comment’ is correct – do I also need to use the class ‘form-control’?

    All ideas appreciated!

    many thanks, j

    #158025
     Laura
    Moderator

    Hello, have you tried using css instead of php?
    For example if the id of your text area is “comment” you could use this css at style.css of child theme

    COPY CODE
    
    #comment {
    height: 200px !important;
    }
    

    Let me know if that works 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #158149
     5high-photohub
    Participant

    Hi Laura,

    Thanks so much for your help – why didn’t I think of the easy option?! Yes, the css worked perfectly! I used this, in case others find this thread:

    COPY CODE
    #comment {
        height: 60px;
        }

    This makes it just a couple of lines deep.

    Many thanks, j

    #158150
     5high-photohub
    Participant

    PS: and if it’s in your child theme style.css, rather than in the css for a single page, you might need to qualify it more like so:

    COPY CODE
    textarea#comment {
    height: 70px;
    }

    Is that right Laura?

    #158265
     Laura
    Moderator

    Hello, both work fine 🙂 Glad you could resolve it!
    If you are happy with the support please rate us 5 stars at themeforest, it would help a lot ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?