• Hello, I would like to know if anyone can help me. I needed to make a customization on the blog of a website, more specifically in the comment boxes. I would like to be able to edit the internal messages of the boxes and remove a field that needs to be filled. How can I do this? Need to be by css or is there an option? Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Can you please share your site link and let me know which field do you want to remove? Do you also want to edit the placeholder text, right? If yes, then you need to edit the theme using the oceanwp child theme.

    Thread Starter bwgiollo

    (@bwgiollo)

    Hi there Amit! The link is below:

    https://www.sitespz.criarsite.online/5-dicas-para-usar-melhor-seu-celular-corporativo/

    the part that you would like to edit is at the link below.

    https://imgur.com/5JV7anL

    What I’d like to do:

    – Edit the internal text where it says “Atualiza??o Necessaria”

    – Remove the “Site” field

    Could you guide me how do I make these changes?

    Add the below code to the functions.php file of the oceanwp child theme and check it works or not. Edit the placeholder text as per your need –

    function oceanwp_modify_comment_form_fields( $fields ) {
    
        $commenter = wp_get_current_commenter();
        $req       = get_option( 'require_name_email' );
    
        $fields['author'] 	= '<div class="comment-form-author"><input type="text" name="author" id="author" value="'. esc_attr( $commenter['comment_author'] ) .'" placeholder="'. esc_html__( 'Name (required)', 'oceanwp' ) .'" size="22" tabindex="101"'. ( $req ? ' aria-required="true"' : '' ) .' class="input-name" /></div>';
    
        $fields['email'] 	= '<div class="comment-form-email"><input type="text" name="email" id="email" value="'. esc_attr( $commenter['comment_author_email'] ) .'" placeholder="'. esc_html__( 'Email (required)', 'oceanwp' ) .'" size="22" tabindex="102"'. ( $req ? ' aria-required="true"' : '' ) .' class="input-email" /></div>';
    
        return $fields;
    
    }
    
    add_filter( 'comment_form_default_fields', 'oceanwp_modify_comment_form_fields' );
    Thread Starter bwgiollo

    (@bwgiollo)

    Hello friend, thank you for your help. It gave 99% right, just got a misaligned field at the end (site field), I tried to edit here in several ways but I could not. Can you help me with this last detail?

    see:

    View post on imgur.com

    Try the updated code below. To remove a field leave it blank like in the below code –

    function oceanwp_modify_comment_form_fields( $fields ) {
    
        $commenter = wp_get_current_commenter();
        $req       = get_option( 'require_name_email' );
    
        $fields['author'] 	= '<div class="comment-form-author"><input type="text" name="author" id="author" value="'. esc_attr( $commenter['comment_author'] ) .'" placeholder="'. esc_html__( 'Name (required)', 'oceanwp' ) .'" size="22" tabindex="101"'. ( $req ? ' aria-required="true"' : '' ) .' class="input-name" /></div>';
    
        $fields['email'] 	= '<div class="comment-form-email"><input type="text" name="email" id="email" value="'. esc_attr( $commenter['comment_author_email'] ) .'" placeholder="'. esc_html__( 'Email (required)', 'oceanwp' ) .'" size="22" tabindex="102"'. ( $req ? ' aria-required="true"' : '' ) .' class="input-email" /></div>';
    
        $fields['url']    = '';
    
        return $fields;
    
    }
    
    add_filter( 'comment_form_default_fields', 'oceanwp_modify_comment_form_fields' );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customization blog’ is closed to new replies.