Showing posts with label Comments. Show all posts
Showing posts with label Comments. Show all posts

Friday 8 November 2013

How To Set Minimum Comment Length In WordPress

Most of us turn on comments in our sites to start a discussion and reach out more people. But some people comment just to get a link back to their own site. Their comments will consist of things like "nice post", "thanks" and all stuff.

If you're running a big website, then moderating these crappy comments will waste a lot of time. So how about setting a minimum character count length on your comments.

Add following snippet to your functions.php file:

add_filter( 'preprocess_comment', 'minimal_comment_length' );

function minimal_comment_length( $commentdata ) {
    $minimalCommentLength = 20;

    if ( strlen( trim( $commentdata['comment_content'] ) ) < $minimalCommentLength )
        {
        wp_die( 'All comments must be at least ' . $minimalCommentLength . ' characters long.' );
        }
    return $commentdata;
}

Save your file. That's it. You can also replace 20 in the above code with your custom value.

Monday 7 October 2013

How To Remove URL Field From WordPress Comment Form

For some WordPress sites, such as themes, review, and all, you may want to remove Website URL field from the WordPress' comment form. Removing the field could be used for product reviews or if they created a support tickets theme that does not require a url field.

It's not much hard to remove/unset the website url from the comment form. Just add following snippet to your functions.php file and it's done:

add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;
}

Thursday 3 October 2013

How To Disable HTML In WordPress Comments



I really hate spammers. They make me sick with their spam comments with all the bold text and hyperlinks. I know that I'm not the only one with this crappy problem, since spammers are everywhere these days. Some of them should write a book about "The life of a Spammer."

You can easily disable HTML in WordPress Comments.So if someone uses the strong code, it will not bold the text etc. It's really important for a WordPresser to disable HTML comments to prevent spammers from commenting with HTML formatted comments.

Just add following code in your functions.php file:

// This will occur when the comment is posted
function plc_comment_post( $incoming_comment ) {

// convert everything in a comment to display literally
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);

// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
$incoming_comment['comment_content'] = str_replace( "'", '&apos;', $incoming_comment['comment_content'] );

return( $incoming_comment );
}

// This will occur before a comment is displayed
function plc_comment_display( $comment_to_display ) {

// Put the single quotes back in
$comment_to_display = str_replace( '&apos;', "'", $comment_to_display );

return $comment_to_display;


That's IT!

Wednesday 15 May 2013

AJAXify Your WordPress Comments

In previous posts, I shared several AJAX tutorial, which were awesome. In this tutorial, I'll show how to AJAXify your default WP comment  system. It's a great must use tutorial.

AJAX comment enables you and your readers to post and reply to comment instantly without refreshing the page. It saves a lot of time and users are more likely to comment. You can check a live demo by clicking here.

I prefer to use Disqus comment box on my sites, but unfortunately Disqus doesn't works with BuddyPress. I'm not the only person who is facing this problem. I was so disappointment when I had to choose default WP comment box, since it reloads on every activity. So, I found a great plugin to AJAXify my default WP comment box.

To AJAXify your WordPress comments, there is a great plugin call wp-comment-master. Below is official description of this plugin:

an elegant and must-have comment plugin to better satisfy your visitors, it has two main features: AJAX comment posting and comment paginitaion.


Installing wp-comment-master:

  • Click here and download this plugin. Visit your WordPress' plugin page and install this plugin.
  • You can also install this plugin from your WP's plugin directory.
  • After installing, just click on active and it's done...

Don't forget to leave a comment...

Thursday 18 April 2013

Using Disqus Comment Box On Multiple Subdomains


Sorry guys, I'm not getting much time because of my exams and bunch of other issues. However, I'm still active in comments to help users. Right now, I'm only replying to users that needs my help. Let's get back to topic.

Disqus comment system is one of the most advances and user-friend service for bloggers and webmasters. With a few quick steps, you can turn your old comment system into a new way to engage your visitors.You can check our full Disqus archive by clicking here, which contains four useful Disqus widgets, and more.

If you're creating a single community for discussions for all your site’s subdomains, you may want to add a single Disqus system on all your domains. It'll make moderating a bit easier, and also less mess around your Disqus dashboard. It also works if you have a different site as your website's mobile version. Here we go:

  • Visit your Disqus comment's General Settings page(for ex. http://example.isqus.com/admin/settings/)
  • Change your website's url from http://www.example.com to http://example.com

That's it! If your sub-domains don’t have related content, then Creating a new Disqus profile for each is better option.

Wednesday 27 March 2013

Enable Reply To Comments Option On Facebook Pages


Facebook have released a new replies to comments feature on Facebook Pages, which is also known as threaded comments.

Tagging other people on comments really sucks (which doesn’t work if you are not "friends" with that person). So, with this feature, you can now reply specifically to their comment, and they will get a notification of it. Almost every Blogger is using this feature on their blog's comment system.

It's a great feature, and I just tested it. As of writing, this feature is only available for brand pages, and you can't use this on your groups or profile, which totally sucks.

How To Enable This Feature:

Pages with over 10,000 "likes" or "Followers" will have this new threaded comments feature automatically enabled. For Pages under 10,000, you need to manually enable it.

To turn on replies for your Page:

  • At the top of your Page, click Edit Page
  • Go to Manage Permissions
  • Select Turn On Replies

People who visit your Page will have the option to reply on posts that were created after you turned on replies.You can learn more about this feature, click here.

Tuesday 5 March 2013

Hiding Links Inside Blogger Comments


Good News!!! The percentage on SPAM has not increased since the last year. Great, you know how high was the percentage last year? 100%!!!

Spam everywhere on your blog comments? Well, it's hard to find and delete every single spam comment from your blog. Even in Blogger, spammers will always target your blog's comment form to spread spam. Blogger's inbuilt spam filter will stop almost every possible spam comments but this will not solve the problem.

Last year, I shared a nice way to reduce email spam. Prayag Verma came up with a simple jQuery powered hack that hides any clickable link and just displays its text.

Code:

<script src='https://widcraft.googlecode.com/svn/jquery.js'/>
<script> 

$('.comment-content a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});

</script>

Add it just before the </body> tag in the Edit HTML. If you want to completely remove the links from the comments , then use this code instead:

<script src='https://widcraft.googlecode.com/svn/jquery.js'/>
<script> 

$('.comment-content a[rel$=nofollow]').hide());

</script>

This works for the Threaded Comments in Blogger, incase you want to make it work for the old Comments in Blogger , then the code is as follows:

<script src='https://widcraft.googlecode.com/svn/jquery.js'/>
<script> 

$('.comment-body p a[rel$=nofollow]').replaceWith(function(){return ($(this).text());});

</script>

Hope this will reduce some spam from your comments. Don't forget to leave your comments...

Sunday 17 February 2013

Adding Disqus Combination Widget To Blogger


Previously, I shared three Disqus widget, you can check all of them at this link. Finally, It's time to share last widget of Disqus widgets series. This is a Disqus Combination widget, which is a combination of all three previous widgets. Nothing much to explain about this. Let's get started. You can also use below code on your html document or wordpress:

  • Go To Blogger > Layout > Add A Gadget > HTML/JavaScript > Paste below code:

<div class="heading blue">
            <h2>Community</h2>
        </div>
        <script type="text/javascript" src="http://wwefansnation.disqus.com/combination_widget.js?num_items=5&hide_mods=1&color=grey&default_tab=recent&excerpt_length=30"></script>
    </div>

  • Replace wwefansnation.disqus.com with your site's Disqus ID.
  • Replace 5 with the number of items your want to display.
  • Replace grey with your preferred color.
  • Replace 1 with 0 if you want to display moderator's name on this widget.

Disqus Combination Widget For WordPress:

You can download add Disqus Combination Widget to WordPress with this plugin.

Saturday 5 January 2013

Manually Adding Disqus Comment Box On Blogger


Previously we discussed about adding Disqus comment system to Blogger. Now i'll tell you how to add Disqus comment system manually on your blog.

If the Disqus gadget installer isn't working, you have the option of manually installing the gadget on your Blogger site. This will require editing your Blogger template HTML, so it won't work with Dynamic Views templates.

  • Go To Blogger > Layout > Add A Gadget > HTML/JavaScript
  • Enter Disqus as the title and the following code for the content:

<!-- Disqus comments gadget -->

  • Click save and the window will close....

Now all done in Layout section of your blog, now it's time to move to the Template section.

  • Go to your blog's Template section and then click the "Edit HTML" button > Proceed
  • Click 'Expand Widget Templates' box
  • Search for the widget you just created in your HTML template by pressing Ctrl-F (Command-F on OSX) then typing Disqus. You should find the following line: 

<b:widget id='HTML1' locked='false' title='Disqus' type='HTML'>

  • Below that locate and DELETE the following code right before the closing tag. The section you're deleting should look like this:

<b:includable id='main'>
  <!-- only display title if it's non-empty -->
  <b:if cond='data:title != &quot;&quot;'>
    <h2 class='title'><data:title/></h2>
  </b:if>
  <div class='widget-content'>
    <data:content/>
  </div>
  <b:include name='quickedit'/>
</b:includable>

  • Now before the closing </b:widget> tag, add the following Disqus code

<b:includable id='main'>
            <script type='text/javascript'>
                var disqus_shortname = &#39;EXAMPLE&#39;;
                var disqus_blogger_current_url = &quot;<data:blog.canonicalUrl/>&quot;;

                if (!disqus_blogger_current_url.length) {
                    disqus_blogger_current_url = &quot;<data:blog.url/>&quot;;
                }

                var disqus_blogger_homepage_url = &quot;<data:blog.homepageUrl/>&quot;;
                var disqus_blogger_canonical_homepage_url = &quot;<data:blog.canonicalHomepageUrl/>&quot;;
            </script>

            <b:if cond='data:blog.pageType == &quot;item&quot;'>
                <style type='text/css'>
                    #comments {display:none;}
                </style>

                <script type='text/javascript'>
                    (function() {
                        var bloggerjs = document.createElement(&#39;script&#39;);
                        bloggerjs.type = &#39;text/javascript&#39;;
                        bloggerjs.async = true;
                        bloggerjs.src = &#39;http://&#39;+disqus_shortname+&#39;.disqus.com/blogger_item.js&#39;;
                        (document.getElementsByTagName(&#39;head&#39;)[0] || document.getElementsByTagName(&#39;body&#39;)[0]).appendChild(bloggerjs);
                    })();

                </script>
            </b:if>
                <style type='text/css'>
                    .post-comment-link { visibility: hidden; }
                </style>

                <script type='text/javascript'>
                (function() {
                    var bloggerjs = document.createElement(&#39;script&#39;);
                    bloggerjs.type = &#39;text/javascript&#39;;
                    bloggerjs.async = true;
                    bloggerjs.src = &#39;http://&#39;+disqus_shortname+&#39;.disqus.com/blogger_index.js&#39;;
                    (document.getElementsByTagName(&#39;head&#39;)[0] || document.getElementsByTagName(&#39;body&#39;)[0]).appendChild(bloggerjs);
                })();

            </script>
</b:includable>

  • Now change EXAMPLE to your site's shortname.
  • Click Save template. Assuming there are no errors, Disqus should properly show up on your site now.

Friday 4 January 2013

Adding Disqus Popular Threads Widget To Blogger


Previously i shared two Disqus widgets. Now it's time to share third widget, which is a way to show some recent popular posts/threads of your blog. I don't have much to say about it right now so let's just get started.You can also use below code on your html document or wordpress.

  • Go To Blogger > Layout > Add A Gadget > HTML/JavaScript > Paste below code:

<div id="popularthreads" class="dsq-widget"><h2 class="dsq-widget-title">Popular Threads</h2><script type="text/javascript" src="http://wwefansnation.disqus.com/popular_threads_widget.js?num_items=5"></script></div>

  • Replace wwefansnation.disqus.com with your site's Disqus ID.
  • Replace 5 with the number of threads your want to display.

Now save and you're done.!!!

Disqus Popular Threads Widget For WordPress:

You can download add Disqus Popular Threads Widget to WordPress with this plugin.

Wednesday 2 January 2013

Adding Threaded Commenting System To Blogger


Most bloggers are already using this system on their blog, but i never used it because i'am using Disqus commenting system, which is better than Blogger commenting system. My brother created a blog call My Droid Arena, and he is using this threaded system in his blog.

After using this trick your Blogger comments will have a reply option. Now let's get started:

  • Go To Blogger > Template > Edit HTML > Proceed.
  • Select (Tick) the "Expand the Widget" Box.
  • Search for the following code:

<b:if cond='data:blog.pageType == &quot;item&quot;'>
  <b:include data='post' name='comments'/>
</b:if> 

  • Once you find the above code, replace it with the following.

<b:if cond='data:blog.pageType == &quot;static_page&quot;'>
         <b:if cond='data:post.showThreadedComments'>
           <b:include data='post' name='threaded_comments'/>
         <b:else/>
           <b:include data='post' name='comments'/>
         </b:if>
       </b:if>
       <b:if cond='data:blog.pageType == &quot;item&quot;'>
         <b:if cond='data:post.showThreadedComments'>
           <b:include data='post' name='threaded_comments'/>
         <b:else/>
           <b:include data='post' name='comments'/>
         </b:if>
       </b:if>

Now go ahead and save the template. That's it for this time. You can also customize this system with some css.

Adding Disqus Top Commenters Widget To Blogger


Previously i shared Disqus Recent Comments Widget, which was an awesome way to show some recent comments and this time i'am going to share Top Commenters widget with you guys. It's a great way to show your site's most active commenters. You can also use below code on your html document or wordpress.

  • Go To Blogger > Layout > Add A Gadget > HTML/JavaScript > Paste below code:

<div id="topcommenters" class="dsq-widget"><h2 class="dsq-widget-title">Top Commenters</h2><script type="text/javascript" src="http://wwefansnation.disqus.com/top_commenters_widget.js?num_items=5&hide_mods=0&hide_avatars=0&avatar_size=32"></script></div>

  • Replace wwefansnation.disqus.com with your site's Disqus ID.
  • Replace 5 with the number of commenters your want to display.
  • Replace hide_mods=0 with hide_mods=1 if you want to hide moderator's name from this widget.

Now save and you're done.!!!

Disqus Top Commenters Widget For WordPress:

You can download add Disqus Top Commenters Widget to WordPress with this plugin.

Wednesday 7 November 2012

Adding Disqus Recent Comments Widget To Blogger


Previously i posted an article about Disqus comments system and now you all are here because you are using Disqus on your blog or website and wanted to know about adding recent comments widget to your blog. Recent comments widget is a really good way to show some recent comments of your blog/disqus on your blog which also encourages more users to comment on your blog. You can also use below code on your html document or wordpress.

  • Go To Blogger > Layout > Add A Gadget > HTML/JavaScript > Paste below code:

<div id="recentcomments" class="dsq-widget"><h2 class="dsq-widget-title">Recent Comments</h2><script type="text/javascript" src="http://wwefansnation.disqus.com/recent_comments_widget.js?num_items=5&hide_avatars=0&avatar_size=32&excerpt_length=200&hide_mods=0"></script></div>

  • Replace wwefansnation.disqus.com with your site's Disqus ID.
  • Replace 5 with the number of comments your want to display.
  • Replace hide_mods=0 with hide_mods=1 to hide moderator's comments.

Now save and you're done.!!!

Disqus Recent Comments Widget For WordPress:

You can download add Disqus Recent Comments Widget to WordPress with this plugin.

Tuesday 2 October 2012

Display Post Author, Date, Labels And Comments With Icons Below Post Titles


Today i'am sharing a great post by Helper Blogger. Here is a great widget to show author name , time , label and a comment bar with icons just below your blogger post titles. When there are no comments posted,the comment link says 'Be the First to comment!' and when there is just one comment it says '1 comment so far'. Here we go :

Installing :

  • Go To Blogger > Template > Edit HTML > Tick expand widget templates check box.
  • Now search for <div class='post-header-line-1'> and just above it paste following code :

<font style='background:transparent url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjavzoRG9bfyrjlRqJ-YEyq_E9VrXArh02J5-_Kb8Ks3jSRVE-e9Eg_gwUG0PjAP54kLQ9z8mJqF1zwkHX4gaMCp5yEChjTt1G5nCyNnyH-ry-san5I1-AeeqmH_YfL7S_aSBVoNG39D-U/s1600/author.gif) no-repeat scroll top left;padding-left:25px;font-size:11px;'><data:post.author/></font> | <font style='background:transparent url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnuBIJuJnKzy9R9IkTwPmSS4X0_5txI0Xsy9Ixk-Cwq6A5dQjXeylNir6xumH1L62aEpYl-cazDM0naaRoLofzdm1XygHP0OOg8jFYTieaUx5XbWBiZ9LH98h-ozsqTPoGg8ZVuJR2j4U/s1600/clock-icon.gif) no-repeat scroll top left;padding-left:25px;font-size:11px;'><data:post.timestamp/></font> | <font style='background:transparent url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDhdzvktxmxLTbsOUvVsExq9HzYnFON7p8OzGwvD4WaUqmdNhdyItxsiG5zEgiijnWRCpbnqZY7Vturb4Xl96iA9N3QqwzAuazWu9JBHdBALwx90YFXrbwb-VoPgk1XNHzrXTVokmZ_hU/s1600/tag+icon.gif) no-repeat scroll top left;padding-left:25px;font-size:11px;'><b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url + &quot;?max-results=8&quot;' rel='tag'><data:label.name/></a>
<b:if cond='data:label.isLast != &quot;true&quot;'>|</b:if>
</b:loop>
</b:if></font>
<span class='post-comment-link' style='Float:right;'>
        <b:if cond='data:blog.pageType != &quot;item&quot;'>
          <b:if cond='data:post.allowComments'>
            <a class='comment-link' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick' style='background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-SZ6VJVZxY0nuGkWd1ezF5fF9s38C9wobjd8TBJMezWUjJ74Hr1WdOhhSzQRjYKJADrevDms8u42BUWEoo0ZB8DJ1XnJko5x69CYXdkpX3l85vo57wCEzjw2dCuxq7nO5vx7nYNvUQdo/s1600/comment-icon.png) no-repeat;Padding-left:20px;'><b:if cond='data:post.numComments == 0'>Be the first to comment!<b:else/> <b:if cond='data:post.numComments == 1'><data:post.numComments/> Comment so far<b:else/><data:post.numComments/> Comments so far</b:if> </b:if></a>
          </b:if>
        </b:if>
      </span>

Customizing :

  •  You can change all icons of this widget and also text to display then there is one or zero comments.

Tuesday 11 September 2012

Top Commentators Cloud Widget For Blogger


It's great way to show you top commenters of your blogger and it's also easy to install. As you can see in above pic this widget just looks like label cloud widget , commenters are the most important part of blogging and it shows them in a cool cloud so i think you might give it a try. It's only available for blogger comment not disqus or any other comment system.

Installing :

  •  Go To Blogger > Layout > Add A Gadget > HTML/JavaScript > Paste following script :

<!-- Top Commentators Cloud Start
(c) 2010 Blogger Sentral. Original code by http://www.bloggersentral.com/. Please do not remove this credit and the “Get this commentators widget” link at the bottom of the code.-->
<div style="text-align:justify;line-height:1.2;">
<script type="text/javascript">
function cCloud(feed) {
max = 0;
min = 10000;
//finding highest and lowest count
for (i=0;i<feed.count;i++)
{
ccCount = feed.value.items[i].commentcount * 1;
if (ccCount > max)
{
 max = ccCount;
}
if (ccCount < min)
{
 min = ccCount;
}
}
ccCountD = "";
display = "";
for (j=0;j<feed.count;j++)
{
ccdiff = feed.value.items[j].commentcount - min;
ccFontsize = 80 + (ccdiff * 100) / (max - min) + "%";
ccUrl = "'" + feed.value.items[j].authorurl + "'";
ccCountD = "(" + feed.value.items[j].commentcount + ")";//comment count
ccName = feed.value.items[j].title + ccCountD;
ccLName = "<a style='font-size:" + ccFontsize + "' href=" + ccUrl + " target='_blank'>" + ccName + "</a>";//clickable commentator name
display = display + ccLName + " ";
}
document.write(display);
}
</script>
 <script src="http://pipes.yahoo.com/pipes/pipe.run?
 YourBlogUrl=http://www.widcraft.blogspot.com/
 &Exclusions=Anonymous,Admin
 &ShowHowMany=20
 &Order=alphabet
 &_callback=cCloud
 &_id=cfa196644e1d6159c9183548c4b5e2f5
 &_render=json"
type="text/javascript"></script>
</div>
<span style="font-size: 80%; float:right;;margin-top:5px;">Get this <a href="http://widcraft.blogspot.com/2012/09/top-commentators-cloud-widget-for-blogger.html" target="_blank">commentators</a> <a href="http://www.widcraft.blogspot.com/" target="_blank">widget</a></span>
<!-- Top Commentators Cloud End -->

Customizing :

  • Replace http://www.widcraft.com/ with your blog's url. Make sure you omit the slash at the end of the URL (as in .com/). 
  • Replace Anonymous,Admin with the commentator names you want to exclude from the cloud. Separate each name with a comma, and don’t put space between them. 
  • Replace 20 with how many top commentators you want to appear in the cloud. 
  • In alphabet Enter alphabet if you want to arrange the names alphabetically. Enter frequency if you want to arrange them by frequency (with the most frequent commentators on top). 
  • cCloud Comment count (in bracket) is displayed by default. To remove it, just delete this line of code.

Sunday 9 September 2012

Adding Disqus Comment Box On Blogger


With a few quick steps, you can turn your old comment system into a new way to engage your visitors.

Why Choose Disqus ?

From small blogs to massive websites, Disqus is the easiest way to build active communities. It's free to use and works with virtually any type of website.

Disqus comment box is one of the most used comment box around the web which makes commenting really easy. It's totally free and if you have a large fan base or big number of visitors then you can also earn some revenue with it , we will discus that in another post.

Disqus gives your visitors to log in and comment via all major social networks including Facebook and Twitter which makes it easy to sign in. If you're a big publisher then you can also add your site's log in option to disqus.

With Disqus your visitors can also attache images with their comment and it's easy for site owner to moderate spam comment.

Disqus also gives you option to reply comments and stay connected with your commenters.

Installing : 

  • Go To Disqus > Create a new account by clicking on 'Get this on your site'


  • Fill the sign up form just like shown below :


Choosing a username is also an art so choose something creative.

  • Now Click on 'Continue' > Choose your platform Blogger/Wordpress/Other... 

You can also use this comment box in other platform with this tutorial because installing in all platforms are totally same.

  • Now in next page click on 'Add Your Site To Blogger' > Add this anywhere on your layout and it's done.
Well it was easy , make sure your blogger comment box isn't disabled otherwise it won't work. After installing you can customize settings of your comment box and disqus will notify you when a user comments your site/blog.

We will discus more features of Disqus in our next posts including making money with Disqus.

Popular Posts

 
Powered by Blogger.