Tag: comments

Backwards-Compatible Spam and Delete Buttons for WordPress

Posted on December 1, 2008 in WordPress by Jeff Starr

Recently, Joost de Valk shared an excellent technique for adding spam and delete buttons to comments on your WordPress-powered blog. The idea is to save administration time by providing links to either “spam” or “delete” individual comments without having to navigate through the WordPress admin area. Joost provides the following plug-n-play solution:

Continue Reading

How to Deal with IE 6 after Dropping Support

Posted on September 22, 2008 in Websites by Jeff Starr

As announced at IE Death march, I recently dropped support for Internet Explorer 6. As newer versions of Firefox, Opera, and Safari (and others) continue to improve consistency and provide better support for standards-based techniques, having to carry IE 6 along for the ride — for any reason — is painful. Thanks to the techniques described in this article, I am free to completely ignore (figuratively and literally) IE 6 when developing and designing websites. Now that I have dropped support for IE 6, I feel liberated, free of the constraints that once enslaved my time, energy, and resources. Working on my new design, I have already saved countless hours that would have been wasted on IE 6. If you are still chained to an old copy IE 6, I highly recommend kicking it to the curb and experiencing the freedom for yourself. All it takes is a few lines of code and the decision to go there.

Continue Reading

WordPress Tip: Link Author Comments to the Home Page

Posted on July 14, 2008 in WordPress by Jeff Starr

[ ~{*}~ ] After almost three years of blogging here at Perishable Press, I had an epiphany about my author comment links. Way back when, after installing WordPress in a subdirectory called “/press/”, I decided to set the URL for my Administrative User Profile’s website as “http://perishablepress.com/press/”. After all, it seemed to make sense at the time, plus it really didn’t seem to matter; nobody was going to see my personal profile information anyway, right?

Wrong.

Three years later, I finally realize that it does matter. The URL that you enter as your profile’s website address is the URL that will be used for every author commentator link on your site. Yes, I know what you’re probably thinking, “what an idiot! I thought everybody knew that!” Well, no, obviously not everybody. It may have occurred to me momentarily or subconsciously at some point along the way, but it wasn’t until just a few days ago that the light bulb finally flashed.

So what’s the big deal? First and foremost, one of the most highly visible and prevalent links to your site comes from your own author commentator links. These links are used to represent your site for every one of your own comments. Other commentators and visitors recognize the link, note the location, and possibly use it when linking back to your site. Thus, it is important to represent your site by linking to the optimal URL in your author commentator links.

Continue Reading

WordPress Tip: Disable Comments in Old Posts via PHP

Posted on July 8, 2008 in WordPress by Jeff Starr

Just a quick WordPress snippet for future reference. I recently explained how to disable comments, pingbacks, and trackbacks via SQL. Here’s a good way to do it via PHP:

<?php 
function close_comments( $posts ) {
	if ( !is_single() ) { return $posts; }
	if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( 30 * 24 * 60 * 60 ) ) {
		$posts[0]->comment_status = 'closed';
		$posts[0]->ping_status    = 'closed';
	}
	return $posts;
}
add_filter( 'the_posts', 'close_comments' ); 
?>

You can run this script as a plugin, through your theme’s functions.php, or through a custom user-functions.php file. Simply set the desired number of days by changing the number “30” to whatever you would like. As is, this script will close comments, pingbacks and trackbacks on all articles posted more than 30 days ago.

Obsessive CSS Code Formatting: Organization, Comments, and Signatures

Posted on July 5, 2008 in Presentation by Jeff Starr

One of my favorite aspects of producing clean, well-formatted CSS code is “meta-organizing” the document using comments. In CSS, comments are included in the stylesheet like so:

/* i am the walrus */

When used constructively, CSS comments serve to break down documents into distinct regions, provide key information about specific declarations, and bring order to even the most complex stylesheets. In my experience, a well-commented stylesheet improves efficiency and optimizes comprehension.

Working with CSS, you can add comments any way you want. There are many different ways to use CSS comments, and endless ways to get there. Let’s check out some practical and interesting ways to use comments, along with some creative ways of doing so.

Continue Reading

Quick Reminder About Downlevel-Revealed Conditional Comments..

Posted on June 11, 2008 in Structure by Jeff Starr

NOTE: This entire article amounts to nothing more than an in-depth learning experience. After writing the article, I realized (painfully) that either format for the second iteration of the downlevel-revealed comment for XHTML is perfectly fine and displays no ill effects or unwanted characters in any browser. Thus, this article is essentially useless, but I am posting it anyway because I just hate deleting several hours of hard work..

As more and more people discover the flexibility, specificity, and all-around usefulness of Microsoft’s proprietary downlevel conditional comments, it behooves us to reiterate the importance of utilizing proper syntax. Specifically, for downlevel-revealed, or negative, conditional comments, the commented content will remain visible unless the associated if condition proves false. For example, if we were using XHTML and wanted to hide a specific CSS file from Internet Explorer 6, we could employ the following conditional comment to do the job:

Continue Reading

Perishable Press Comment Policy

Posted on April 8, 2008 in Perishable by Jeff Starr

Before you comment here at Perishable Press, please take a moment to review the official comment policy. Here is a simplified overview of the complete policy:

Comments are open to everyone. Name and email are required. Email kept private, never shared. Website URL optional. The form accepts basic XHTML. Line and paragraph breaks automatic. Please wrap each segment or line of code in <code> tags (no <pre> tags). I reserve the right to edit/delete any comment. Spam will be deleted. Pointless and otherwise lame comments may be deleted. Please stay on topic and comment intelligently.

Official Comment Policy

First, everyone has something to say, including people who disagree with your opinion. One of the purposes of this site is to provide an open forum where everyone is entitled to express their ideas. The goal is to encourage new ways of thinking by listening to the thoughts of others. If your goal is merely to argue and rant about some particular issue, please unload yourself somewhere else. If, on the other hand, you are genuinely interested in exploring the topic at hand with openness and honesty, then by all means, get involved. We are all looking forward to hearing your opinions and learning from your ideas.

As for the fine print, there are a few additional points, encompassing several technical and administrative aspects of the commenting process. First of all, use your real name or nickname, not a site name or business name. Using a site name or business name is a good way to get your link or comment removed. Technically, commentators must provide a valid email address. All email addresses will be kept completely private and never will be shared with anyone. Each comment author may provide an optional website link, which will be served with the author’s name. If you do not provide a website link, your author name will be displayed in text only. When leaving a comment, basic XHTML (e.g., <em>, <strong>, <a>, etc.) may be used to format the text. Line breaks and paragraph tags are automatic. Please wrap code examples in <code> tags. Also, please note that certain comments are moderated; if your comment does not appear after several days, or if you wish to comment privately, contact me.

Continue Reading

WordPress Tip: Remove Spam from the Comment Subscription Manager

Posted on March 10, 2008 in WordPress by Jeff Starr

[ Image: Jonny Quest (Inverted) ] After investigating some unusual 404 errors the other day, I found myself digging through the WordPress Admin trying to locate the “Subscribe to Comments” options panel. As it turns out, administrative options for the Subscribe to Comments plugin are split into two different areas. First, the S2C plugin provides configuration options under “Options > Subscribe to Comments”, which enables users to tweak everything from subscription messages to custom CSS styles. New to me was the other half of the S2C administration area: the Subscription Manager! Carefully hidden under “Manage > Subscriptions”, the Subscription Manager provides several useful ways to filter your email subscribers:

Continue Reading

WordPress Discussion Management: Enable or Disable Comments and Pingbacks via SQL

Posted on February 20, 2008 in WordPress by Jeff Starr

[ ~{*}~ ] Continuing my quest to stop comment spam without using plugins, I have decided to disable comments on “old” posts. In my experience, over 90% of comment, trackback and pingback spam occurs on posts that have been online for over a month or so, just long enough to be indexed by the search engines and picked up by spammers. Especially for older posts that have managed to acquire a little page rank, the frequency of spam attempts is far greater than it is for fresher content. Throw dofollow comment status into the mix, and say “hello” to a hellish number of spam attempts on established pages. Thus, my evolving anti-spam strategy now includes discussion management, which involves periodic closing of feedback on older posts. In this article, we will examine currently available methods of managing comments, and then proceed with a versatile toolbox of SQL queries for complete discussion management.

Continue Reading

New Version of BlogStats PCC for WordPress 2.3

Posted on October 28, 2007 in WordPress by Jeff Starr

Just a note to announce the release of a new version of BlogStats PCC. BlogStats PCC is a free WordPress plugin that provides an easy way to share your blog’s core statistics with your visitors. You can show off any or all of the following statistics:

  • total number of posts
  • total number of comments
  • total number of categories
  • total number of registered users
  • total number of unregistered users
  • total number of individual, static pages
  • the date of the most recent post modification
  • a link to the most recently published blog post
  • a link to the name of the most recent commentator
  • date/time of the most recent blog update, displayed in your default date format

BlogStats PCC enables you to display any or all of these statistics in any location (inside the loop or elsewhere). The plugin is completely free, totally customizable, and extremely easy to use. The new version (2.3.0a) works with all versions of WordPress (1.5 - 2.3), and is available for immediate download via the official BlogStats PCC information/download page.

WordPress Spam Battle: 3 Seconds that will Save You Hours of Time

Posted on October 8, 2007 in WordPress by Jeff Starr

In the hellish battle against spam, many WordPress users have adopted a highly effective trinity of anti-spam plugins:

This effective triage of free WordPress plugins has served many a WP-blogger well, eliminating virtually 99% of all automated comment-related spam. When spam first became a problem for me, I installed this triple-threat arsenal of anti-spam plugins and immediately enjoyed the results. Although Spam Karma seemed a little invasive and resource-intensive, too much protection seemed far better than not enough.

Even so, during the most recent redesign of the site, one of my goals was to lighten things up as much as possible — fewer scripts, fewer images, fewer plugins, etc. During that process, I decided to drop both Bad Behavior and Spam Karma. What a mistake that turned out to be! At first Akismet held up just fine, but it only took a few weeks before Perishable Press got hit hard: over 300 spam comments, trackbacks and pingbacks snuck through the Akismet gate. Needless to say, I was extremely upset and spent over two hours scouring the database to remove the stench.

Continue Reading

Hacking WordPress: The Ultimate Nofollow Blacklist

Posted on September 19, 2007 in Function, WordPress by Jeff Starr

[ Image: Death-metal rocker drunk with power ] Several days ago, I posted an article explaining how to hack your own WordPress nofollow blacklist. Immediately thereafter, I published an elaborate article focusing on automatic methods of nofollow blacklisting via WordPress plugins. In this article, I expand on the original blacklist hack by incorporating functional differentiation between commentator links, trackbacks, and pingbacks. If anything, think of this as an exercise in hacking WordPress, rewarding in and of itself, if not otherwise entirely impractical. Of course, whenever possible, you should avoid hacking the WordPress core and install a plugin instead. ;) Nonetheless, it’s so much fun to hack that we simply could not resist posting just one more article involving nofollow attributes. But alas, we really should be moving along..

Continue Reading

Hacking WordPress: Dofollow Whitelist for Commentator Links

Posted on September 18, 2007 in Function, WordPress by Jeff Starr

[ Image: Inverted Eye Detail ] Before repenting of my filthy “nofollow” addiction, I experimented briefly with a “dofollow whitelist” for commentator URL links. The idea behind the whitelist is to reward frequent commentators, feed subscribers, site patrons, and other guests by selectively removing the automatically generated nofollow attributes from their associated comment-author links. For nofollow enthusiasts, a dofollow whitelist is a great way to show appreciation for people who support your blogging efforts.

Now, before we go hacking away at WordPress, keep in mind that there are a few potential shortcomings to this method. First of all, manually maintaining such a list would eventually fail. It simply would require too much work. Perhaps as an automated WordPress plugin, a dofollow whitelist would be a reasonable solution. A dofollow whitelist plugin would also eliminate the need to hack the WordPress core, which the following hack definitely requires. Other issues involve duplicate author names and user verification. Nonetheless, even as an elementary WordPress hack, a dofollow whitelist for comment signature links may prove useful. Here are a few examples:

Continue Reading

WordPress Plugins Featuring Nofollow Blacklist Functionality

Posted on September 17, 2007 in Function, WordPress by Jeff Starr

Is that spam or are you just trying to comment?

Removing nofollow attributes from your WordPress-powered site is a great way to encourage comments and attract visitors. Many commentators will leave useful, constructive feedback, but there will always be a few losers who would attempt to game your generous link love. Fortunately, identifying these mindless link whores is relatively easy. Here are a few priceless examples of actual spam (i.e., linked) comments left here at Perishable Press (links removed for obvious reasons):

  • Work at Home Start earn $150/day right now. Part time work for everyone. Nationwide opportunity Our adress. Part Time Job
  • Hi all! Yo u may find it interesting to visit some helpful info on in . lorazepam index index and very creative : ind-z inde in ciprofloxacin index and else ind diaz index tramad soma. neuro Lip or imitrex-i imitrex i-diflucan claritin-i i and look this map , zoloft zithromax soma index3l sildenafil index1.html inde Regards
  • Many forms virus available disease burden especially when baycol inclusion. Legal and new corona beclometasone means to beconase for rate beldin insomnia. With adoption and transfer the experience belladonna counts at bellamine-s lawsuits. Pennsylvania over costs had bactrim after about fixed. Glutamate is to see bactroban loss of balziva material. The calf with lots banan for better defense verdict scale. Bank or greater dependence nurses quit banthine naloxone. Dynamics of dding between barbital is taken disruptive. Plasma protein made such sequential samples barbituric open. Children would cocaine vaccines baros yet those basiliximab skin.

Continue Reading

Hacking WordPress: Nofollow Blacklist for Commentator Links

Posted on September 12, 2007 in Function, WordPress by Jeff Starr

[ Image: Extreme close-up of an eye (send email  to purchase a full-size version) ] Previously, in our unofficial “WordPress dofollow upgrade” series, we dished several techniques for removing the antisocial nofollow attributes from default installations of WordPress. After an exhaustive review of available dofollow plugins, we explained how drop-dead easy it is to transform any WordPress blog into a well-standing member of the dofollow community without relying on a plugin to do the job. Our next article detailed a nofollow removal hack selectively targeting pingbacks, trackbacks, and commentator links. Then, we went off the deep end with a robust, threefold hack for sitewide nofollow extermination. Now, in this article, we merge several of these methods to implement a “nofollow blacklist” for trackback, pingback, and commentator links.

Why would you want to create a nofollow blacklist? There are several scenarios in which such a strategy would benefit a dofollow-friendly WordPress site. After upgrading to dofollow status, you should experience an increase in the number of comments left at your site. Although this is generally beneficial, there remain those gutless worms who would seek to game your generous link-love with hollow remarks, empty chatter, and other useless nonsense. Rather than waste pagerank and make a big stink, quietly blacklist offenders until they change their mindless ways. Simply put, a nofollow blacklist protects your dofollow site while reinforcing positive comments.

Continue Reading

Industrial Strength WordPress Dofollow Upgrade

Posted on September 11, 2007 in Function, WordPress by Jeff Starr

Encourage Comments by Completely Eliminating All Nofollow Links

Want to remove all traces of the hideous nofollow attribute without having to install yet another unnecessary plugin? By default, WordPress generates nofollow links in three different ways — this article will show you how to eliminate all of them..

Some context please..

Note: if you are already familiar with the various functions involved in the nofollow-removal process, please feel free to skip the proceeding discussion and jump directly to the tutorial.

WordPress adds nofollow to all trackbacks, pingbacks, and commentator links

We have seen how simple it is to eradicate nofollow from comment-related content, which includes the three different types of $author URLs: trackbacks, pingbacks, and commentator links. In fact, WordPress generates hyperlinks for each of these comment-author URLs via the function get_comment_author_link(), which is conveniently located in the file wp-includes/comment-functions.php in WordPress 2.0 and wp-includes/comment-template.php in WordPress 2.1 and 2.2:

Continue Reading

The Deluxe One-Minute Dofollow WordPress Upgrade

Posted on September 10, 2007 in Function, WordPress by Jeff Starr

After our previous article, we all know how easy it is to kill the default nofollow attributes that WordPress automatically injects into all commentator, trackback, and pingback links. Indeed, our original one-minute upgrade delivers dofollow links across the board, effectively passing the love juice to every type of response. Fine for some, but some need more..

In this article, we improve the original dofollow upgrade by differentiating between the three different response types. With our “deluxe” model, nofollow attributes may be removed selectively from trackbacks, pingbacks, commentator links, or any combination thereof. For example, you may remove nofollow from commentator links while dishing full juice to trackbacks and pingbacks.

Ready? Let’s do this thing..

Continue Reading

The One-Minute Dofollow WordPress Upgrade

Posted on September 9, 2007 in Function, WordPress by Jeff Starr

Want to upgrade your blog to official dofollow status but don’t want to install another unnecessary plugin? This article explains how to eliminate nofollow tags from all trackback, pingback, and commentator links in less than one minute..

After finally repenting of my nofollow sins, I began looking for the best way to eliminate the nofollow attributes that WordPress automatically injects into all commentator URL links.

Of course, the most popular technique for removing nofollow attributes from comment links involves one of the many fine dofollow plugins that are freely available to WordPress users. Beyond nofollow removal, many of these plugins also provide additional features, such as control over when and where nofollow tags should be removed. Many of these plugins are highly recommended.

After considering the various dofollow plugins, I came to the conclusion that most of them were simply overkill. My goal was to remove all nofollow attributes from commentator links — nothing more, nothing less. For this site, I just don’t need all the fancy bells and whistles. And I certainly don’t need yet another resource-draining plugin to worry about..

Continue Reading

Another Mystery Solved..

Posted on July 25, 2007 in Function, WordPress by Jeff Starr

Recently, after researching comment links for an upcoming article, I realized that my default <input> values were being submitted as the URL for all comments left without associated website information. During the most recent site redesign, I made the mistake of doing this in comments.php:

...

<input class="input" name="url" id="url" value="[website]" onfocus="this.select();" type="text" tabindex="3" size="44" maxlength="133" alt="website" />

...

Notice the value="[website]" attribute? It seemed like a good idea at the time — I even threw in a nice onfocus auto-highlighting snippet for good measure. I ran the form with this in place for around eight weeks before finally noticing multiple comments using this for their site URL:

Continue Reading

Wrapping Your Head around Downlevel Conditional Comments

Posted on July 18, 2007 in Function by Jeff Starr

If you think you understand the logic behind Microsoft’s downlevel conditional comments, you are sadly mistaken. Sure, they seem simple enough on the surface, but as you really try to wrap your head around how and why they work, the subtle complexities of downlevel conditional comments may leave you dazed and confused…

[ Image: Human Head via Photographic Cubism ] In our previous article on Internet Explorer’s exclusive browser-detection method, downlevel conditional comments (DCC), we present an introductory exposition, defining expressions and providing several generalized code examples. Overall, it is a very useful article but partially fails at explaining the logic and functionality behind conditional comments. In this article, we strive toward a solid understanding of downlevel conditional comments — how they work, why they work, and where they work. Sure, you could just copy and paste code until something clicks, but actually understanding conditional comments will give you the edge — increasing your knowledge and improving your productivity.

Continue Reading

Contact Perishable via Comment

Posted on October 22, 2006 in Perishable by Jeff Starr

If you have question, comment, or concern, and prefer to leave a comment rather than send an email, please drop a comment via the form below. I keep a close eye on all comments left on this post, and will do my best to respond in as soon as possible. Please note that all comments left at this post are open to the public and available for anyone to see. That said, have at it!

BlogStats PCC Plugin

Posted on August 28, 2006 in WordPress by Jeff Starr

Announcing the BlogStats PCC plugin for WordPress! BlogStats PCC is the easy way to display the total number of posts, comments, categories, as well as several other great statistics for your WordPress-powered website. With BlogStats PCC, you display only the information you want, where you want — inside or outside of the WordPress loop. Completely customizable, BlogStats PCC will display any combination of statistics you choose. This plugin is highly flexible, simple to use, and completely free.

Update: New version of BlogStats PCC now available! The new version now provides all of these great site statistics:

  • Total number of posts
  • Total number of comments
  • Total number of categories
  • Total number of members
  • Total number of guests
  • Total number of pages
  • Date of most recent update
  • Most recent commentator
  • Most recent post

Display any or all of the provided site statistics — customize your own set to provide only the statistics you want!

Installation and Usage

  1. Unzip blogstats-pcc.zip and copy blogstats-pcc.php to your plugins directory.
  2. Upload and activate via WordPress plugin admin panel.
  3. Add any of the following calls to wherever you would like the information displayed:
Display the entire set of statistics in a nice list format:
<?php if (function_exists('fullstats')) { fullstats(); } ?>

Display the total number of posts, comments, and categories:
<?php if (function_exists('blogstats')) { blogstats(); } ?>

Display the total number of posts:
<?php if (function_exists('poststats')) { poststats(); } ?>

Display the total number of comments:
<?php if (function_exists('commstats')) { commstats(); } ?>

Display the total number of categories:
<?php if (function_exists('catstats')) { catstats(); } ?>

Display the total number of registered users:
<?php if (function_exists('regusers')) { regusers(); } ?>

Display the total number of unregistered users:
<?php if (function_exists('userstats')) { userstats(); } ?>

Display the total number of individual, static pages:
<?php if (function_exists('pagestats')) { pagestats(); } ?>

Display the date of the most recent post modification:
<?php if (function_exists('modstats')) { modstats(); } ?>

Display a link to the most recently published blog post:
<?php if (function_exists('recpost')) { recpost(); } ?>

Display the name of the most recent commentator as a link:
<?php if (function_exists('reccomm')) { reccomm(); } ?>

Display the date of the last update in your blog's default date format:
<?php if (function_exists('recstats')) { recstats(); } ?>

Download the Latest Version

Download BlogStats PCC [ version 2.3.1 | ~3KB | .zip | 902 downloads ]

Previous/Alternate versions of BlogStats PCC

Display the Total Number of WordPress Posts, Comments, and Categories

Posted on August 28, 2006 in Function, WordPress by Jeff Starr

Would you like to display the total number of posts, comments, and categories for your WordPress-powered website? Here is the code that can make it happen 1!

Update: The count posts part of this method should only be used for WordPress versions less than 2.5. For WordPress versions 2.5 and better, there is a built-in function for displaying the total number of posts. See The WordPress Codex for more information.

<?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts); 

$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);

$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php',  $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>

Here is a modified version of the code, customized for our use here at Perishable Press:

<?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts); 
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);
$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>

<?php echo $numposts . ' posts and ' . $numcomms . ' comments in ' . $numcats . ' categories'; ?>

Footnotes

Gravatars at Perishable Press

Posted on May 21, 2006 in Perishable by Jeff Starr

Step right up and leave a comment! Complete Gravatar functionality in full effect. Leave a comment to sport your gravatar. Of course, you must have a gravatar to use this feature. Check out this post to see some tuf gravatar action in effect.

Hint: gravatars are the small images that appear next to post comments. They are meant to represent the person leaving the comment.