Miscellaneous communication blog add comment http. In search of the perfect commenting system. Nickname: Ideal Solution

This name does not bother many people, but sometimes the question arises of how to change add a comment to leave a review or the like. In this case, this article will help you. As I wrote above, I’ll show you a couple of ways.

Method No. 1

For the first method, you must find the file in the folder with the theme that is installed on your website comments.php. If there is one, open it and look for the array in it that is responsible for setting up and displaying the contents of the comment form. It looks something like this:

$args = array("comment_notes_before" => "

", "comment_field" => "

", "id_submit" => "comm_subm", "label_submit" =>

So, to this array, you need to add a new parameter with the desired value and that’s it. In our case, this is:

"title_reply" => "Leave your review",

As you understand - Leave your review, this is the new name instead of - Add a comment. You can add such a parameter at the end or at the beginning of the array. It will turn out something like this:

$args = array("title_reply" => "Leave your review", "comment_notes_before" => "

Fill out the fields below. Your email will not be published. Required fields are marked *

", "comment_field" => "

", "id_submit" => "comm_subm", "label_submit" => "Submit",); comment_form($args);

Added to the beginning and now, on the post pages the line will be displayed - Leave your review. This method is not complicated and requires minimal effort, the main thing is to correctly define the array. But sometimes it happens that there is no comments.php file inside the theme or there is no array in it and you don’t know how to add it there correctly, then the second method will help you.

Method No. 2

The essence of the second method is to add a new function, which will replace the name. To do this, in the folder with the active theme, you need to find the file function.php with custom functions and in a convenient place, if you don’t know this, then at the very end before the closing PHP tag - ?> , if there is no such thing, then just add the following code at the very end:

Function wph_change_submit_label($defaults) ( $defaults["title_reply"] = "Leave your review"; return $defaults; ) add_filter("comment_form_defaults", "wph_change_submit_label");

Bonus

This is essentially the same as what was done in the first method, simply, there we implemented it directly into the array, and here through a filter. After these steps, you will see a change in the name. As in the first method, you can change the text - Leave your review to the one you like. This text is provided as an example.

I also want to suggest and draw attention to the declension of the word Comments. If your form displays the line - 1 comment published or Comments: 10. You can use the Function from the article. If you are already using it, I recommend in a line with an array:

Array("comment","comment","comments")

Change the names to review, review, reviews if you used this word in the methods above. this way, you will have everything the same, and not scattered, there are reviews and there are comments.

This is the information I wanted to provide you with today. Perhaps it will be useful to someone.

That's all, thanks for your attention. 🙂

Instructions

If a professional platform is used for the site, usually a paid one, it already has all the necessary modules, including a comment block. But what should you do if you are just learning web design, have created a simple website in pure html and want to give visitors the opportunity to leave messages?

To add a comment block to the site, use the service Disqus. After installing this platform on the site, its visitors will be able to leave their remarks.

Register for the service. In the Site URL field, enter the address of our website. In the Site Name field - its name. It’s a little more complicated with the Site Shortname field - here you need to enter the short name of the site, that is, without http, www and ru. For example, if your site is named http://site12345.ru, then enter site12345 as the short name. As a result, the subdomain site12345.disqus.com will be created. By clicking on it, you will be taken to the comments settings panel.

After entering all the data, click Continue and the settings panel will open. Select Russian language, then configure Optional Features. In Facebook Connect, you can give Facebook users the ability to post comments from their account. To do this, you need to enter the API Key: you can get it by clicking on the link just below the Facebook Connect item, but for this you must have an account on this service. In the Twitter @Replies field, enter the name of your account, it will be used for replies.

Now configure the checkboxes (switches). If you check Media Attachments, then all links to media files will be shown at the bottom of the comment as attached files. Trackbacks – shows trackbacks to the page. Akismet – connecting an anti-spam service. Reactions – shows online mentions of your site. Finally, if you check the Display login buttons with comment box checkbox, service buttons will appear above the comment form - Facebook, Twitter, etc.

After filling out the form, click Continue. A new page will provide options for connecting to different platforms. If you wrote the site code yourself, select Universal Code. To install the code, copy it from step 1, then paste it into the place on your page where the comments should be. Then copy the code from step 2 and paste it before the closing /body tag.

All you have to do is correctly format the links leading to the page with comments. For example, if the page for comments looked like http://site12345.ru/comment.html, then the link should be like this: http://site12345.ru/comment.html #disqus_thread. After that, check the ability to leave comments, everything should work.

Hello! After writing a bunch of posts at the request of working bloggers, I decided to return to writing thematic posts. The topic for the next couple of weeks will be commentary.


Here are the posts I have planned:
1) Setting up comments (Today)
2) .
3) .
4) Alternative services for posting comments (IntenseDebate).

So today we are talking to you about setting up comments (Allow or not allow comments, Notification of new comments by email, Moderation of comments).


Let's go as always Control Panel- Settings - Comments

And here we have parameters that can be changed... if you see them in English, they are very easy to understand, but if you see them in Russian, then I really sympathize with you and this article is for you!

1) Comments. They can be Showed or Hidden. If you choose hide comments they will not be deleted, Blogger will simply not show them until you give it permission to do so.

Important note. You can also show or hide comments at the post level. Go to the Blogger Editor and in the lower left corner of the editor you will see a pseudo-link Message settings click on it and in the left column Reader comments you can choose: a) Allow b) Deny, show existing ones c) Deny, hide existing ones.

In my opinion it is very convenient. In case you would like to make some of your articles informational. There is nothing to discuss here ;).

2) Who can post comments? Here you can allow comments on your articles: Anyone - including Anonymous users,
or Only registered users- includes OpenID | Only users with Google accounts | Only members of this blog.

Comment. If you select anything other than the first item Any, your readers with the https protocol disabled, like at my work, will not be able to post a comment.

I don’t remember what the default is, but in all my blogs it’s Any. And if I can still understand the commenting only blog members(the blog in this case is a collective creativity and comments are still the same continuation of this creativity). I can’t imagine in which case it might be necessary to filter out commentators based on the presence of a Google account or OpenID... This is akin to announcing your blog as DoFollow, and then complaining about spam. You should protect yourself from spam by pre- or post-moderating comments.

In general, I don’t really understand the DoFollow game.... Being an introvert myself, I rarely comment when I feel the need for my comment and it never depends on the Do or No Follow policy of the blog. The only difference in DoFollow blogs is that I use OpenID (if a person is ready to give me a link for my words, then let it be a link to my blog, in which I put a lot of effort, than a link to my profile).

3) Placement of a form for entering comments. Possible choices here would be: Full Page. Pop-up window, Message attached below. It's purely a matter of taste. Here you just need to try one or another and decide what suits you best. For a long time Message attached below was only on WordPress and was the subject of my daily envy. The availability of the comment form under the article and on the Blogger platform made me absolutely happy... Although in this blog, I changed the settings to “pop-up window”, because I write very long articles and often when answering questions I have to refer to the article itself.

By the way, what do you think about the possibility of placing a comment form after the article right on the main page? This is real, I have already conducted a successful experiment in changing the layout of the blog accordingly... The pros and cons are obvious: It is very easy to leave a comment, especially if you don’t care what people have already said before you.. This, in general, is both both plus and minus. Write if you are interested and I will write a post on how to do it.

4) Default setting for comments in posts. There are only two meanings: New posts have comments or New posts have no comments. Here, in contrast to point 1), we mean the ability to leave comments, and not hide/show. We have already discussed how to change these settings for a single article in the same paragraph 1).

5) Backlinks. They can be Showed or Hidden. In general, I don't see much point in them. Starting with the fact that they are NoFollow by default. And sometimes, as ButterflyYanochka noted (And I have a “link”), these links will not even be related in any way to the content of your post (just links from blogs where your blog is on the reading list).

Some bloggers find it very convenient to use the ability to create backlinks... (ButterflyYanochka writes in detail about this: How to send a link to a blog post) - the option can be useful for collective blogs, but I draw all my links by hand in the old fashioned way. If you have forgotten how to do this, take a look here at your leisure:

6) Default setting for backlinks in posts. Similar point 4) only this time about backlinks. There are only two possibilities: New posts contain backlinks And There are no backlinks in new posts.

And just as in the case of comments for each post, this parameter can be adjusted manually. While editing, click the same link: Message settings and now in the second column (Backlinks) you can choose from three options: Allow | Deny, show existing | Deny, hide existing.

7) Timestamp format for comments: Well, we don't have anything significant here, just a comment date and time format.

8) Message of the comment creation form. By this phrase, the translators meant that you can write any text in the proposed window (Perhaps something like: “What do you think about this?”) and this text will be shown above the comment form.

9) Entering comments. This more than mysterious phrase means Entering pre-moderation of comments. And after my “translation” it is clear what the possible values ​​of this parameter mean: Always ( moderate comments), (Impose moderation) Only to messages older than several days, Never (do not moderate comments). This is my translation of this paragraph.

There is even lower there a field for entering your email address. If you enter your address there, you will receive notifications about comments received on your blog that need your approval.

Or comments that need moderation (their number), you will see on Toolbars opposite your blog.

Whether to pre-moderate, post-moderate comments, or arrange a piece of freedom of speech on your blog without any restrictions, everyone, like everything else in their life, decides for themselves. Let me just remind you that the blogger is responsible for ALL the content of his blog and for comments that may offend other readers too.

10) Show GUI based check for comments? This means an ordinary captcha (from the English “Completely Automated Public Turing test to tell Computers and Humans Apart” - a fully automated public Turing test to distinguish computers and people) Wikipedia].

As for me, I have not yet had a single comment appear on any blog that I would suspect of being automatically created. There aren't that many comments coming in, and I review them all before publishing (moderate them), so I don't need a captcha.

11) Show profile pictures in comments? I have “Yes”, but this only works for comments that are posted only on the entire page, or in Popup window. It will show, for commentators who used a Google profile in their signature, an image from their profile. Sorry, I can't use the word profile as a computer term, profile is much better...

12) Notification of comments by email. You can enter up to 10 email addresses.

Hello, friends and blog guests! Today I’ll tell you using PHP and MySQL. And we will also talk about commenting systems for the site and we will choose the best one for your site from the ones I offer.

Question one: by using PHP and MySQL?

To do this, you and I first need to create a table in the database of your site, which will be called - comments. This created table will store comments in fields with the following designations:

id is a unique identifier.
page_id— this field will store the identifier of the site page on which this comment is located.
name- this is the name of the commentator who left this comment.
text_comment— accordingly, this is the text of the current comment.

The next step, after creating a table for comments in the database, we need to implement special code for our future comments on the site. This code on the site will allow our commentators to add their comments to our articles. Here is the code:


This is a simple HTML comment form for the site. You place it on your website in a place where it is convenient for leaving a comment on a post - naturally, under the post itself.

query("INSERT INTO `comments` (`name`, `page_id`, `text_comment`) VALUES ("$name", "$page_id", "$text_comment")");// Add a comment to the table header(" Location: ".$_SERVER["HTTP_REFERER"]);// Do we redirect back?>

The last step in creating a comment form for a site in PHP and MySQL is to display our comments on the site page. Here's the code for this:

query("SELECT * FROM `comments` WHERE `page_id`="$page_id""); //Fetch all comments for this page while ($row = $result_set->fetch_assoc()) ( print_r($row); //Output comments echo "
"; } ?>

That's all! Our simple comment form for the site has been created and can work on the site.

But this is certainly not for a beginner who won’t bother with all that HTML, PHP and MySQL code. Nor will he learn how to create a database. He needs everything at once, quickly and without headaches. I'm right? Of course you're right!

Then let's move on to the next section of my material and find out everything about ready-made comment systems for the site and choose the most convenient, functional and acceptable for your site...

Comment systems for the site. Which one to choose?

How to make comments on the site- this is an important question because comments on a site play an important role not only for communication between the site owner and the visitor, but also comments are important for SEO promotion and promotion.

With the help of comments on the site, the site’s position in search results increases, behavioral factors improve, traffic to the site increases, and, consequently, your earnings increase. You see how important comments are for the site!

So let's take a look how to make comments on the site and which one commenting system choose the best option?

In general, comments on websites are displayed in many ways. These include special plugins for wordpress engines and all kinds of comments from social networks, such as In contact with, Facebook, Disqus. There are also independent services that offer their own comment systems for the site, for example.

I’ll now give you one tablet that will immediately put everything in its place and no questions will arise about choosing a comment system for the site:

Here you can clearly and clearly see which comment system is the best and several presented ones, which are most often used by webmasters on their resources. I think that explanations are unnecessary here and the choice is yours!

I have already made a decision for myself and installed a comment system for my site from Cackle.

By the way, if you have already decided to choose a system for your website, then here is a link that gives 5% discount to purchase a comment system from Cackle!

That's all I have for today! Good luck and prosperity to everyone! See you again!

(in which we removed h3 tags in the header before the comment form) - today we will make the WP comment form function work entirely according to our rules:

We will have the opportunity to set our own styles, change the “Add comment” title at our discretion, exclude, if necessary, certain information entry windows, for example, the url form, customize the placeholder, etc. and, most importantly, do not lose all this when updating the engine.

Now we can easily achieve our goal, just by editing the function file. And if you feel strong enough to edit the site code (this method is a little more complicated than the one described earlier)…

Let's start the concert:

Is it worth editing WordPress core?

As you know, editing the WordPress core (CMS files) is not a recommended activity, largely due to the fact that after updating the engine, work is lost! Moreover, for novice resource administrators, these WordPress updates are made suddenly (without their knowledge). How to avoid this, read this.

Is it worth upgrading WordPress?

Absolutely yes! …there can be no disagreement here! ...however, this is fraught, as was said, with the fact that the engine update will overwrite the administrator's editions!

Therefore, many web masters, for more flexible settings of their site, use all kinds of filters (hacks): not bad either! However, I (and not only me) prefer to move some minor (relative to the importance of constant updates) functions of the WP core to the root of the template.

Thus, output the necessary adjustments to the theme files in order to manage the state of the site at the template level: without any losses)

Let's start editing, but!!

...I remind you every time: create some kind of document “memory” of all the incidents committed with the blog. Copy edited files. It will come in handy!

Believe me: this is short of professionalism, because the possibility of digesting accumulated grains of knowledge into mush is unlikely!

What we need to achieve the goal:

transfer the processing of the comment_form function from the WP core (from the comment-template.php file) to the template directory.

where to find the comment-template.php file

Follow this path your_domain/wp-includes file comment-template.php

...open it (or directly on the hosting - that’s what I do), or download and edit it in Notepad++ - read: how to configure Notepad++

Look for a line like this (approximate line number 2111)

function comment_form($args = array(), $post_id = null) (

do_action("comment_form_comments_closed");

You copy all this and transfer it to your functions file functions.php.

Typically, all new code additions are placed before the closing ?> tag. But I recommend grouping the added code, so to speak, by topic, then you can easily find everything if necessary.

The next step is to change the name of the function: you can call it whatever you want, even designate it with a personal monogram... I did it like this:

function my_my_ comment_form

We save our achievements...

...and go to your theme's comments.php file.

In this file we need to change the name of the function call to the one we called in the first step:

Look for the following phrase in the document (it’s usually at the end):and simply add my_my_ or your name.

It should look like this:

...now the task of calling the new function is completed: the template logic will use our code copied into the theme!

Just what we needed!

Now all you have to do is edit the code of the newly created function my_my_comment_form();

...or set up an individual placeholder - look at what it looks like for me:

...in my comment form window there is a monogram “Your comment...” which disappears as soon as the commentator types his message...

...and so on...and so on...like that.

If you have any questions about adding/removing elements of the comment form, write and we’ll sort it out...

or you can read the post about useful snippets () for the comment form...