Questions tagged [comment-form]

This tag outputs a complete commenting form for use within a template. Most strings and form fields may be controlled through the $args array passed into the function, while you may also choose to use the comment_form_default_fields filter to modify the array of default fields if you'd just like to add a new one or remove a single field.

Filter by
Sorted by
Tagged with
0
votes
0answers
20 views

Dropdown list that loads Product Comment Form

I am trying to create a dropdown of all product in my WooCommerce store and based on the selected product I want to display that products comment form. I want to create a page with this code in it. ...
0
votes
1answer
13 views

How do I check which comment fields are required in my theme?

I plan to use comment_form() with a bunch of arguments to format the output. However, I need to know which fields have been set to required (to style them as such). How do I do that?
0
votes
1answer
236 views

How to get top rated posts using wp query?

I want to get top rated posts using wp query. The rating value is store in comment meta database table when some one post a comment on wp post or cpt.Please screenshot EDIT Here is my code ...
0
votes
0answers
23 views

Store comment form custom field in custom database

I'm trying to add custom field created on comment form to custom database. But my solutions not working. How to change/improve it? I add custom fields this way: function add_interests( $fields ) { ...
0
votes
0answers
11 views

Comment input hiding when clicking on reply link

I am building a wordpress site. There I noticed when I click on 'Reply' link in wordpress comment section, the textarea for posting the comment hiding. I need to show both comment textarea and reply ...
0
votes
1answer
48 views

How to Send Confirmation Emails to Users after Form Submission?

I would like to run a confirmation e-mail on Contact Form 7 What I want is: Once a form has been submitted, the visitor who sent the form must confirm it by going to the email address. A confirmation ...
1
vote
0answers
18 views

Add a default WP comment form to forum template

I've learned that it is possible to add a default comment to the custom post type: https://codex.wordpress.org/Plugin_API/Filter_Reference/comments_template However, what if in case of not custom ...
1
vote
1answer
43 views

How to add a title field in comments?

Just like WP posts have title and text, I want to have titles to my comments. Now how do I add it and show them above the comment texts like a title. I need it to have a css name as well. The title ...
0
votes
0answers
15 views

How is it possible to create Multi part sections where people can answer or comment or vote on various parts of a page's content as given example?

How is it possible to create Multi part sections where people can answer or comment on various parts of a page's content as given example? Using this as a reference example (can attach screenshot if ...
0
votes
0answers
22 views

Rearrange fields from comment_form() / send one to bottom

I modified the fields in comment_form() to hide the website field and created one that's for a phone number. So far so good. The problem is that this Phone field shows last, below the cookie consent. ...
1
vote
1answer
83 views

Remove “at” string from wordpress comment date

I'm using the following code to format the author's comment date and remove the time: function my_change_comment_date_format( $date, $date_format, $comment ) { return date( 'd M Y', strtotime( $...
0
votes
0answers
37 views

All comment automatically added as spam comment, how to set that problem?

All comment(all post) automatically added as spam comment. Our same project set in two server, but in one server project blog comment working proper and another server project blog all comment added ...
1
vote
1answer
183 views

Global $post not working in OOP function WordPress

I added a custom field with comment form. Below is my code.First function return post id when using var_dump function.But the last function return NULL always. class Post_Rating_Public_Helper { ...
0
votes
0answers
198 views

How do I make comment-reply-button with <span> that takes to comment reply form on click

I do need your help. I'm actually designing my personal blog's theme and I got stuck when I could not code a working comment-reply-button with span element. I know you must be wondering why with a ...
0
votes
1answer
16 views

Author name length character limit?

In comments, I want to limit author names. For example, the author's name should be no more than 10 characters. I'm looking for a way to do this. Thank you very much in advance.
0
votes
1answer
35 views

Check if comment author has url

I wanted to add target=_blank to comment author link and also wanted to add redirection link to url. So here is what I did: <a href="site.com/go?url=<?php echo get_comment_author_url(); ?>" ...
1
vote
1answer
665 views

How to add consent checkbox in comment section

To fulfil the GDPR policy, I want to add a consent checkbox under the "Post Comment" section. I have followed the WpBeginner tutorial and put the following code in my Comment.php file // Now we will ...
0
votes
1answer
679 views

Comment form on custom page template

I have created a custom page template, but I don't know how to add the WordPress comment form to my <body> tag. I tried to include the following in my template.php file in the body tag, but the ...
1
vote
1answer
16 views

changing font size and font of a custom message added after comment

hi i have added a code in function file of the theme to show a default custom message after the user leaves a comment of the blogposts . it reads like this . add_filter('after_comment_text', '...
0
votes
0answers
58 views

Change “Logged in as a <name>. Log out?” link in comments form?

A portion of this question has been previously answered Here. I have used the filter-codes as written on the answer. But that only does the user-profile permalink part. The Log out option still stays....
0
votes
1answer
35 views

How to make comment reply available only for login members of a certain user roles only?

I use the default public WordPress comment system. But I want to make my comment reply only available to admin and author user roles. How do I achieve that?
1
vote
1answer
34 views

Notification if Comment Author Field is left empty. E.g. change input border colour

I am having a comment section on my website. The author comment field is required. Any idea how to display a notification for a user if author field is left empty after submitting the comment? ...
1
vote
1answer
28 views

Is it possible to force login for comments only on custom-post-type or the custom comment template?

I use a custom page template review-template for my custom post type reviews. And on my template, I use a custom comment form review-comments. Now... How do I enable login only for my review-comments ...
0
votes
1answer
418 views

Full Front End, AJAX comment system and comment reply script

I am write a dynamic comment system, without page refreshing. The problem is, how do I move the "form" element to add sub comments? Like the comment-reply.min.js My workspace: <script type="text/...
0
votes
1answer
27 views

I'm unable to call img path using single quotes in an array?

I would like to call an image next to input field in wp comment form. But I'm unable to do that. I call image when '' <= single quotes doesn't exist. But I don't know how to call an image in single ...
1
vote
0answers
19 views

Assign author to comment from post edit page

How we can assign author to comment while creating this from post edit page. When i add new comment it always automatically assign login author to this comment. But i want there a select box that user ...
3
votes
1answer
639 views

Why does comment_reply_link launch the reply form at the wrong spot on the comment section?

I have this custom extended Walker_Comments class: class Custom_Comment_Walker extends Walker_Comment { var $tree_type = 'comment'; var $db_fields = array( 'parent' => 'comment_parent', '...
0
votes
1answer
138 views

Can not edit comment form

I'm trying to add author, email fields to comment form but the comment form does not change. It is always showing a default template with only the comment field and submit button. Could this be a ...
0
votes
1answer
76 views

Fetching Initials of the Commentator in the Wordpress Website

function getInitials($str) { $words = explode(" ", $str); $initials = null; foreach ($words as $w) { $initials .= $w[0]; } return $initials; //DT } echo $str = ...
1
vote
1answer
119 views

How do I add an extra field to comment form above the submit button?

I have added a custom subscribe field to the WooCommerce comment form. However, right now the field is above everything else. I am not sure how to move it to the bottom below the other fields. The ...
0
votes
1answer
20 views

Show this code if user has previously left a comment

Below is my code which is inserted into the comment template, It should show the comment form, if the user has never posted a comment on a particular post. Or if they have posted a comment on this ...
0
votes
1answer
16 views

How to call out the date of user's first comment?

For example, Sam's first comment was posted in 2010. How can I show this next to his name in the comment section? Like this: SAM [Joined since 2010] Update: Sorry for the unclear question. I am ...
0
votes
1answer
43 views

Removing(replacing) avtar in comments.php with some other HTML arrangements

<ol class="comment-list"> <?php wp_list_comments( array( 'style' => 'ol', 'short_ping' => true, ...
1
vote
0answers
23 views

comment form args are not translatable (customized comment form)

I customized the comment form by changing the 'args'. Short Example: $comments_args = array( 'title_reply' => esc_html__( 'Leave a comment', 'mytheme' ), 'title_reply_to' =&...
0
votes
1answer
69 views

WordPress comment submit button substitutes/options

$args = array( 'id_form' => 'commentform', 'class_form' => 'comment-form theme-comment-action', 'id_submit' => 'submit'...
1
vote
1answer
2k views

Create comments.php form of custom HTML code

One example of the comments.php is available here. I have created comments.php file in my theme folder. In my content.php my HTML for displaying comment form looks like this: <textarea name="name"...
0
votes
1answer
373 views

Change “logged in as a <username>” link in comments form

I want to change the "logged in as " link that displays in the reply comments form if logged in. The link is leading to wordpress profile in the backend, which it shouldn't. I want it to just a ...
0
votes
1answer
448 views

Remove the function which adds nofollow to links in comments

Not sure where the function is that does this but i need to remove it so all links in comments do not contain the rel="nofollow" attribute. I know i can use the comment_text filter to remove nofollow ...
0
votes
1answer
607 views

get_comments_number() returns 0

I am customizing a theme that has the following code to display comments: if ( have_comments() ) : ?> <h2 class="comments-title"> <?php printf( // WPCS: XSS OK. ...
0
votes
1answer
64 views

duplicate comment section functionality and call it something else for custom post types

I have a custom post type that I want people to leave messages but I dont want to call it "comment". How can I replicate the comment functionality and call it something else for a custom post type? I ...
1
vote
1answer
430 views

How to add attributes to the comment form tag?

How can I add attributes to form tag? Below is my code but it does not add the attributes I need: $args = array( 'title_reply'=>'', 'comment_notes_before' => '', 'logged_in_as' =>...
0
votes
1answer
752 views

How to add extra input fields to CPT's comment form?

I found filter hooks to add/modify the WordPress default comment form. But I couldn't find how to add extra fields to a CPT's (custom post type) comment form. I actually want to know the right way of ...
0
votes
1answer
287 views

Custom markup for the comment form

The issue The comment form, as i planned to design it, will use Bootstrap's input groups and probably input addons. Translating in bare coins, the needed markup for each input is like this: <...
0
votes
1answer
236 views

comment_for() Custom fields not visible when user is logged in

i have added some custom form fields using comment_for() as well as filtering the comment_form_default_fields and comment_form_defaults hook for the purposes of using a custom comment field as well as ...
1
vote
1answer
237 views

comment_form() Not changing the default class/id of elements

EDIT I am trying to change the class and id of the <form> element and well as the <input>/Submit button field using the comment_form() function. How ever it appears that various string ...
0
votes
1answer
196 views

Cannot display comment in page

I added some custom fields in comment, so i have a couple of more fields. from that form I can comment but am unable to display that comment. The comments are set to moderation so admin have to ...
1
vote
1answer
92 views

What functions does WordPress use for filtering / sanitizing comments?

We have some custom built comments (ones tied to custom post types, that we can't integrate with WP's comment system). But we want to filter the comments when they are submitted the way WP does and ...
1
vote
0answers
750 views

create comment box in woo-commerce shop order [closed]

i want to add comment box for Woo-commerce shop order and i am using the below script but its not working. function enable_comments_shop_post_type() { add_post_type_support( 'shop_order', '...
0
votes
1answer
300 views

How to pass settings to comment_form() if theme only uses comments_template()?

I have a theme which uses comments_template() to write a comment form and existing comments to a page. It appears that comments_template() calls comment_form() internally which writes the form that ...
0
votes
1answer
614 views

edit comments in front end

I build my custom comments template. And i realised tht edit comment is being done in back-end ( dashbord). Is there any way to enable edit comments in the front-end instead of in admin menu? Would be ...