Impact add comment comment reply. WordPress comments are the complete look and feel. Customizing comments

Hello, friends! This article will show you how to see comment replies via mail to your commenters.

Replies to comments via the Comment Reply Notification plugin

Despite the fact that today is December 31 and it's time to celebrate the New Year 2016, there is a need to write an article on the blog, because no one has canceled the publication schedule. The published article is not New Year's at all, the congratulatory article was published a little earlier. Taking this opportunity, I congratulate you, dear readers of the blog, on the upcoming New Year, I wish you good health, happiness, good luck and prosperity. You can read a congratulatory article, see photos and videos on the blog.

During the training in the Expert Group (EG), many students asked questions about installing and configuring the Comment Reply Notification plugin, the blog readers had the same question. More precisely, there was a question about how to make your blog commentator see your replies to comments. There is no article on this topic on the blog, but I think today's article will correct this situation.

So, a reader made a comment on your blog. Naturally, you or another reader responds to it, but the commentator may not find out about this and will not write his new answer. To fix this situation, there is a Comment Reply Notification plugin that sends responses to comments by mail. That is, the reader wrote a comment on your blog, you answered it. Now the Comment Reply Notification plugin immediately notifies the commenter by mail that his comment has been answered.

As a rule, the commenter returns to the blog and writes new replies to the comments. For your blog, this is very good:

  • firstly, new comments appear, search engines believe that the article is interesting and raise its significance;
  • secondly, new comments start a discussion and new commentators are involved in the commenting process;
  • thirdly, writing comments (responding to comments) takes time, which means people will stay on the blog more, improving behavioral factors;
  • fourthly, constant commentators will increase the core of your blog's audience.

As you can see, it is important to communicate responses to comments to people via email. Therefore, you need to install the Comment Reply Notification plugin on your blog.

Installing the Comment Reply Notification plugin is quite simple and is shown in the video below. Next, the Comment Reply Notification plugin is activated and its settings are made. Click in the control panel "Settings" and "Comment Reply Notification", go to the plugin settings page. We connect the function "Always inform", in the field "Settings for the subject of e-mail notification letter", we prescribe the name of our blog (site).

Now you need to customize the text of the letter itself. It is presented as a code in English. For the correct display of the letter in Russian, which will be sent to the commentator, it is necessary to replace a number of English phrases with Russian ones. Below are the phrases that you can insert into the letter template, if you wish, you can change them:

  • Your comment on the post.
  • Got a new answer.
  • Here is your comment.
  • Here's a new answer.
  • You can see more comment information for this article here.
  • Thanks for the comments.
  • Comment Reply Notification.
  • This email was sent automatically, please do not reply to it.
  • The replacement itself is shown in the attached screenshots:

    Phrases that are underlined in red should be replaced with Russian ones (shown above).

    It should turn out like this.

    After changing the text of the letter, click the "Save settings" button. This completes the work on setting up the Comment Reply Notification plugin. Watch the video showing the process of installing and configuring the Comment Reply Notification plugin:

    Now commentators will automatically receive emails, and they will see the replies to comments immediately. Use this amazing plugin to promote your blog. Good luck to you!

    Get new blog articles straight to your inbox. Fill out the form, click the "Subscribe" button

    WordPress has several types of content such as posts, pages, comments. WordPress is a very flexible platform that allows you to customize the main types of content to suit your site. You can change the look and feel. In this tutorial, we'll show you how to change the behavior and appearance of comments on a WordPress site.

    Step 1. Understanding the comment_form function and its arguments

    Consider the WordPress comment_form function. It is responsible for displaying the comment form that is displayed on the page or post. The call to this function can mostly be found in the comments.php file in the theme folder. This file is included in various places, such as single.php and page.php , either directly or through a call to the comments_template function.

    The function description can be found in the WordPress codex.

    If you use the comment_form function to render a form, it will be rendered using the default parameters and will contain fields such as name, email (both fields are required), website, and comment content. In the default Twenty Eleven theme, the form will look like this.

    Some important arguments to the comment_form function:

    • fields - with its help you can control the output of fields in the comment form.
    • comment_notes_before and comment_notes_after are used to display information before and after the form.
    • title_reply - used to change the title of the response, which defaults to 'Leave a Reply'.
    • label_submit - used to change the text on the comment submit button.
    Step 2. Customize the comment form using the comment_form function

    Now let's customize our comment form by passing arguments to the comment_form function.

    In case we need to customize the fields in the comment form, we need to pass a list of them to the comment_form function. By default, the function uses the following list of fields:

    $fields = array("author" => "

    " . "" . __("Name") . " " . ($req ? "*" : "") . "

    ", "email" => " ", "url" => "

    " .__("Website") . "" . "

    ",);

    If we need to remove a field, say website , we just need to exclude it from the array and pass the array to the comment_form function.

    $commenter = wp_get_current_commenter(); $req = get_option("require_name_email"); $aria_req = ($req ? " aria-required="true"" : ""); $fields = array("author" => "

    " . "" . __("Name") . " " . ($req ? "*" : "") . "

    ", "email" => " ",); $comments_args = array("fields" => $fields); comment_form($comments_args);

    In addition, we will also change the name of the form to ‘Please give us your valuable comment’ and the label on the button to ‘Send My Comment’.

    To complete the task, we pass the following arguments to the comment_form function:

    $commenter = wp_get_current_commenter(); $req = get_option("require_name_email"); $aria_req = ($req ? " aria-required="true"" : ""); $fields = array("author" => "

    " . "" . __("Name") . " " . ($req ? "*" : "") . "

    ", "email" => " ",); $comments_args = array("fields" => $fields, "title_reply"=>"Please give us your valuable comment", "label_submit" => "Send My Comment"); comment_form($comments_args);

    The comment form will now look like this:

    Step 3 Removing fields from a form with a hook

    Also the WordPress comment form can be modified with hooks and filters. This setup can be especially useful when working with a plugin when you need to tweak a few elements but not change the theme files. Filter to add or remove form fields - ' comment_form_default_fields '

    Let's remove the URL address field using a filter. The above code can be used in a plugin or in the active theme's functions.php file.

    Function remove_comment_fields($fields) ( unset($fields["url"]); return $fields; ) add_filter("comment_form_default_fields","remove_comment_fields");

    Step 4: Adding Data to the Comment Form with a Hook

    We can add fields to the form with the filter ' comment_form_default_fields '. Let's add the author's age field using a filter and save this field with additional data and display it in the comments.

    Add a field like this:

    Function add_comment_fields($fields) ( $fields["age"] = "

    " .__("Age") . "" . "

    "; return $fields; ) add_filter("comment_form_default_fields","add_comment_fields");

    #respond .comment-form-author label, #respond .comment-form-email label, #respond .comment-form-url label, #respond .comment-form-age label, #respond .comment-form-comment label ( background: #eee; -webkit-box-shadow: 1px 2px 2px rgba(204,204,204,0.8); -moz-box-shadow: 1px 2px 2px rgba(204,204,204,0.8); box-shadow: 1px 2px 2px rgba(204,204,204, 0.8); color: #555; display: inline-block; font-size: 13px; left: 4px; min-width: 60px; padding: 4px 10px; position: relative; top: 40px; z-index: 1; )

    Now our comment form will look like this:

    Age is now stored as additional information. You need to use a hook in ' comment_post ':

    Function add_comment_meta_values($comment_id) ( if(isset($_POST["age"])) ( $age = wp_filter_nohtml_kses($_POST["age"]); add_comment_meta($comment_id, "age", $age, false); ) ) add_action("comment_post", "add_comment_meta_values", 1);

    Once the data is saved, it can be displayed in a comment like this:

    Step 5 Setting comments for specific post types

    Sometimes you want to use fields in comments only for certain types of posts. Let's change the code to display the age field only for the record type book :

    Function add_comment_fields($fields) ( if(is_singular("books")) ( $fields["age"] = "

    " .__("Age") . "" . "

    "; ) return $fields; ) add_filter("comment_form_default_fields","add_comment_fields");

    Step 6. Create a return function for displaying comments

    The wp_list_comments function is used to display comments in posts. In the WordPress Code function is described in detail.

    wp_list_comments has a ' callback ' argument which can be used to define a function that is called when a comment is displayed.

    In the Twenty Eleven theme, in the comments.php file, you can find the line:

    wp_list_comments(array("callback" => "twentyeleven_comment"));

    Let's change it to:

    wp_list_comments(array("callback" => "my_comments_callback"));

    The my_comments_callback function will be called for every post.

    Step 7 Styling the Comments

    Now we will change the style of the comment a bit. We will simply display the content of the post and the age field that we added earlier. We will also change the background color for comments.

    Function code ‘ my_comments_callback ’:

    Function my_comments_callback($comment, $args, $depth) ( $GLOBALS["comment"] = $comment; ?>

     
    Articles By topic:
    Utilities for resuscitation of damaged laser discs
    Displays various information about installed CD/DVD drives, their characteristics, and the ability to read/write media of various types. In addition, VSO Inspector can scan disks for errors and check the readability of data written to them. Free
    How to find out by mobile phone number where they called from?
    About the service Sometimes your mobile phone receives calls or SMS messages from unknown phone numbers. In order for you to find out from which region you called or sent SMS, we have developed this service. Enter the phone number or the first
    How to install Windows operating systems using the WinNTSetup program Installing Windows on a different disk partition
    Installing a second Windows on a different disk partition from a running first Windows. In order not to languish in waiting for the installation media to load while system files are copied from it to the hard drive, installing a second Windows can be simplified using
    Writing square brackets in Microsoft Word How to remove gray square brackets in word
    Do you know how to put square brackets in Word? If so, then you still won’t name four ways to do it, but they exist. It is about them that we will talk in this article. We will consider the most trivial methods, and the most sophisticated - those