How To Customize WordPress’s Tag Cloud Widget

You don’t have to use it with default settings.

If you use WordPress widgets on your self-hosted WordPress blog, you may not be fully satisfied with the way the Tag Cloud widget looks and works on your site. I know I wasn’t. The maximum font size was too large for the most commonly used tag (helicopters, on my blog) to fit into the column in which I’d put it. Since I wanted my tag cloud in the narrow column in which it resided, I had to make a change.

The answer is to modify the wp_tag_cloud function in the category-template.php file. It’s remarkably easy to do. Here’s how.

  1. Open the file /wp-includes/category-template.php.
  2. Scroll down to the line that begins function wp_tag_cloud. If you’re using WordPress 2.7 and haven’t made any other changes to this file, you should find it at line 552. (You can always do a search for it; I found the general area by searching for “tag cloud.”)
  3. Make changes in the array as follows:

    Tag Cloud Function

    • To specify the smallest font size, set the value after ‘smallest’. The default is 8 points.
    • To specify the largest font size, set the value after ‘largest’. The default size is 22 points.
    • To specify the maximum number of tags included in the cloud, set the value after ‘number’. The default number of tags is 45.

    My Tag CloudI changed my settings to 6, 16, and 75 respectively. You can see the results in the screenshot here, as well as in the sidebar for my blog, An Eclectic Mind.

  4. Overwrite the existing file with the changed file.

When you reload a page that uses the Tag Cloud widget, your changes should appear immediately.

Keep in mind that if WordPress is updated and the file you changed is replaced, you may have to repeat these steps to reset your defaults.

Learn More

Lynda.comLearn more about working with a self-hosted WordPress 2.7 installation — or WordPress.com. Check out my WordPress courses on Lynda.com.

4 Great Articles about WordPress 2.7

Why reinvent the wheel?

WordPress LogoLast night, the folks at Automattic updated WordPress.com to version 2.7. The self-hosted version of WordPress is still in beta, although Release Candidate 1 (RC1) was released two days ago.

I’ve been working with WordPress 2.7 for about two weeks now (since Beta 2) and am absolutely thrilled with it. The Dashboard and administrator interface has been completely reworked to make it not only more useful, but easier to navigate. Sure, a lot of folks will be grumbling about the change from horizontal-on-top to vertical-on-left navigation, but when you look beyond the obvious, you see a true user interface improvement.

There are plenty of other new features, too. But rather than write my own article about them, here are links to five other articles written by folks who clearly love WordPress as much as I do. Read up, upgrade, and enjoy!

2.7 Gets Here in 2 Days! by Jane Wells on the WordPress.com blog was the first official announcement of 2.7′s upcoming appearance on WordPress.com. Jane helps fuel the excitement with a great description of the new features.

10 Things You Need to Know about WordPress 2.7 by Aaron Brazell on Technosailor states, “This is not your grandma’s WordPress!” (Not sure if I should be offended by this; there’s a chance I might be old enough to be his mother.) He then goes on to describe and state his opinions of the new features.

WordPress 2.7 – 20 Must See Features by Sean P. Aune on Mashable lists the 20 features he finds most notable with a few screen shots.

WordPress 2.7 arrives Thursday night is a shorter and more to-the-point piece by Joshn Lowensohn on cnet news. It links back to the first article here (which I also think is the best) for a full discussion of features.

I’ll be writing a bit about WordPress for Maria’s Guides as I find new tricks and tips to share. I’ll also be revising my Lynda.com training material to cover the new features available on WordPress.com.

If you have specific topics you’d like to see me cover, please use the Comments link or form for this post to list them. Please — no tech support questions for a weird problem you might be having; that’s what WordPress’s support forum are for. I’m interested in addressing “how to” questions, although I can’t promise to answer every one I receive.

MacVoices Interview about WordPress.com Video Training

I’m interviewed!

MacVoices LogoWordPress.ccom DVDIn early August, I was interviewed by MacVoices producer Chuck Joiner about my new Lynda.com course covering WordPress.com, WordPress.com Essential Training. The interview went live today. You can read about the interview, access related links and listen to our conversation on the MacVoices Web site.

MacVoices, by the way, is available as a podcast. It’s a great way to get news about new Mac products delivered to iTunes and your iPod. If you haven’t checked it out yet, please do! I don’t think you’ll be disappointed.

Tips for Promoting Your WordPress.com Blog

A few tips for WordPress.com bloggers interested in attracting more readers to their blogs.

I’ve been doing a lot of work with WordPress.com lately, preparing some new training material to cover the new features and revised administrator interface. Part of my new material is a list of tips for WordPress.com bloggers who want to attract more readers. Here’s the list:

  • Create original, well-written content. Too many blogs just rehash what’s already out there on the Web. But if your content is new and original, you’re more likely to attract readers who want fresh information or a different, independent point of view.
  • Blog regularly. If you’re serious about attracting readers, you’ll need to post new content at least a few times a week. Be committed and you’ll be rewarded with a strong following.
  • Stay focused. Studies have shown that popular blogs have one thing in common: they focus on a limited number of topics. Readers find this attractive because they know that if one of your posts interests them, they’re likely to find other posts that also interest them. This simply isn’t true if your blog covers a very wide range of topics.
  • Comment on other people’s blogs. When you comment, you often have the opportunity to include a link to your site. If your comment is thoughtful and appropriate, you might encourage others to come visit your site.
  • Share your blog URL everywhere you can. Three good places is on business cards, letterhead, and your e-mail signature. I bet you can think of a few more places if you try hard enough.
  • Use appropriate keywords in your blog posts. Key words are picked up by WordPress.com. If you apply an appropriate keyword, WordPress.com visitors may discover your blog when exploring a keyword.
  • Enable the Related Links extras feature of WordPress. This includes your blog among those blogs that can appear in related posts list on other WordPress.com blogs.

What do you think? Can you apply these tips to your blogging activity?

Upgrade WordPress Plugins Automatically

One of the great new features of WordPress 2.5.

One of the challenges of keeping a WordPress blog running smoothly is making sure all installed plugins are updated promptly when new versions become available. WordPress 2.5 makes this easier than ever by adding an Automatic Upgrade feature.

As shown in the following illustration, the a note in the Plugin Management administration panel indicates that the Bad Behavior plugin (which I rely on to keep the spambots off my blogs) has been updated.

Plugin Management

I have two options for bringing my blog up to date:

  • Download version takes me to the Bad Behavior page on the WordPress.org’s Plugin Directory so I can read about and download the update. This functionality has been around for a while — at least since WordPress 2.3 — with all plugins that support it.
  • Upgrading a PluginUpgrade automatically takes the update process a step further. When I click this link, WordPress automatically downloads, uncompresses and installs the new version of the plugin for me. It displays its progress as it works, as shown here, and confirms that the upgrade has been successful.

I’ve been using this new feature for a few weeks now and it’s worked like a charm. It’s a heck of a lot easier than upgrading the old fashioned way.

Video Blogging with Viddler and WordPress, Part IV

Displaying a list of your recent Viddler videos in your WordPress blog.

If you start using Viddler regularly — either to create video blog entries as discussed in the previous article of this series or to simply get video content online — you might want to make those videos accessible from within your WordPress blog. Fortunately, there’s a WordPress plugin that makes this very easy: viddlerRSS.

The ViddlerRSS plugin works like most other WordPress plugins. Drop it in your plugins folder and activate it. (You can learn more about how to do that in our WordPress book, so don’t expect to find details here.) Then open your WordPress dashboard and choose Options > viddlerRSS. Enter your Username in the appropriate box, select the number of videos to display and, if desired, enter the HTML code you want before and after each video thumbnail. Then click Update viddlerRSS.

viddlerRSS Options

Now roll up your sleeves and open the template file where you want to insert the Viddler video thumbnails. (Need help modifying theme files? You can learn about that to do that in our WordPress book, too.) In most cases, this will be your sidebar.php template. Insert the following code into the file where you want the thumbnails to appear: <?php get_viddlerrss(); ?>

Or you can get fancy like I did and put some intelligence into it, in case you ever need to disable the viddlerRSS plugin. Here’s the code I use, which includes a heading and other formatting settings:

<?php if (function_exists('get_viddlerrss')) { ?>
<li>
<h2>My Latest Viddler Videos</h2>
<?php get_viddlerrss(); ?>
</li>
<?php } ?>

Save the changes to your template file.

My Viddler VideosNow check your blog to see the results of your efforts. As shown here, I’ve got viddlerRSS set up to display thumbnails for my most recent three videos in my blog’s sidebar. Pointing to a video’s thumbnail displays the title of the video, which can help people decide whether they want to view it. Clicking a thumbnail image opens the video on the Viddler site.

Easy enough, right?

The next (and last) article in this series will explain how you can include a video commenting feature in your WordPress blog. Stay tuned!

Video Blogging with Viddler and WordPress, Part III

Recording and posting a video.

If you have a camera — like a built-in iSight, WebCam, or DV camera connected via a cable — you can record video using tools on the Viddler site. This is probably the fastest and easiest way to get a video blog entry recorded and online.

Recording a Video

Here are the steps to record a video:

  1. Log into your Viddler account at http://www.viddler.com/.
  2. Click the Record button in the green navigation bar (or elsewhere, wherever you see it).
  3. Recording VideoThe Record from WebCam screen appears with an Adobe Flash Player Settings dialog atop it. Click the Allow button so Flash can access your audio and video input devices.
  4. Recording VideoIn the Select Quality dialog, choose an option suited to your connection speed. I usually choose Medium because I have a relatively slow (512 Kbps) Internet connection. Then click Okay.The screen should show an image of whatever your connected camera is looking at. In my case, I’m using a built-in iSight Camera on my 24-inch iMac, so it’s looking at me:
    Recording Video
  5. Check the Audio, Video, and Quality settings. In the illustration above, it’s using my externally connected iSight for audio, which is wrong. I want it to use the Built-in Microphone, so I select it from the pop-up menu. My built-in iSight camera is identified as a USB Video Class Video — it works, so I won’t argue. I believe the external iSight connected to my computer does not appear in the menu because it’s being used by other software (Evocam, which produces my WebCam).
  6. When you’re ready to record, click the red Record button. The status bar animates with a diagonal red stripe as you record. When you’re finished, click the Red button again.
  7. Wait while Viddler saves your video. It’ll display a status arrow thingie as it works. When it’s finished, it shows the poster frame of the video. If you wait long enough, it’ll play back to you:
    Recording Video
  8. If you like what you see, click the Save button. If you don’t, hit that red Record button again to discard the video and record a new one.

Please remember that I simply cannot provide details about every single camera that you might be using with your computer and I can’t offer troubleshooting assistance if you can’t get this to work. If you have problems, consult Viddler’s online support options. Although you can post a question in this post’s Comments, be aware that I won’t reply if I don’t have an answer. Someone else, however, may have the information you seek.

Setting Video Options

When you save a video, it appears in a Recorded video window:

Recording Video

There are a few things you should set for it:

  • Click the Edit link beside the name of the video (“Recorded video”) and enter a more appropriate name for the video. Don’t forget to click the Save link beneath the new name to save it.
  • If desired, enter tags in the Tags field on the right side of the video. You’ll need to enter each tag separately and click the Add Tag button after each one. (I’m not big on tagging, so I don’t usually do this.)
  • Under Sharing Options, choose Everyone. After all, if you’re going to put this on your blog, you want everyone to be able to see it, right? If a Save Changes button appears there, be sure to click it.

Posting the Video on Your Blog

This is where the setup covered in Part II of this series pays off.

  1. Click the Blog This button under the video.
  2. In the list of blogs that appears beneath the video, click the link for the blog you want to add it to.
  3. Fill in the blog post form that appears:
    Recording Video
    The title will be the title of the blog post. The Post is the text that will appear in the post with the video. (I got fancy with some HTML to link to the first blog post in this series.) You can select a radio button at the bottom of the form to determine whether the video should appear above or below the post text. (I usually choose below.)
  4. Click the Send button. A message should confirm that the video has been successfully posted to your blog. Here’s what mine looks like:
    Recording Video

Now wasn’t that easy?

I should note here that you can use the Blog This button under any public video you see on the Viddler site. So if another Viddler user creates a cool video you want to share with your blog’s readers, you can add it to your blog, along with some comments, as discussed here.

Next up: Displaying an archive of your recent Viddler videos in your WordPress blog.

Video Blogging with Viddler and WordPress, Part II

Setting blog options on Viddler.

Once you’ve set up your Viddler account, you’re ready to set a few options that’ll make blogging from it easy.

  1. Log into your Viddler account at http://www.viddler.com/.
  2. Click the Options button near the top of the page, under the “Hello, yourname” greeting.
  3. In the Account Options screen, click the Blog Settings link. You should see something like this, although there won’t be any blogs listed for you.
    Blog Settings
  4. Click the + Add Blog button to display configuration fields.
  5. Enter your blog’s name in the Blog Name box and select the type of blog from the Blog Type drop-down list. The entry area expands to offer options applicable to your type of blog. Here’s what it looks like for a WordPress blog:
    Viddler WordPress Settings
  6. Fill in the rest of the fields. The Blog API Endpoint is the URL to your blog’s Home page followed by /xmlrpc.php. You should know the Username and Password.
  7. To prevent having to enter your password every time you send a Viddler video to your blog, turn on the Remember Password button.
  8. Click Submit.
  9. Viddler checks the information you entered. If it is correct and provides access to your blog, a green “Success!” message appears. Click the Awesome button. The blog is added to a list under Your Blogs.

You can repeat this process for as many blogs as you have access to. And, as you may have noticed, Viddler supports many different blog types, including TypePad, Blogger, Movable Type, Manilla, and Vox. So even if you’re not a WordPress user, you can use this feature. And yes, it does work with WordPress.com based blogs — not just the server install blogs.

What does this do for you? It sets up your account so that whenever you see a Viddler video that you want to embed in your blog, your account information is already provided and you’re good to go.

Next up: Recording a video on Viddler.

Video Blogging with Viddler and WordPress, Part I

What’s this all about?

One of the things I’ve been following from arm’s length is the audio and video blogging phenomena. I’m talking about sites like Utterz, Seesmic, and Viddler.

I’ve tried all three and until I tried Viddler, I couldn’t get excited about any of them. But Viddler has a few features that make video blogging easy and fun — primarily because it works so well with WordPress.

In this series of articles, I’ll explain how you can use Viddler to create video content with any compatible camera attached to your computer and get that content on your blog. And, if you’re a WordPress user, I’ll tell you about two Viddler plugins you can use to make it easy for your blog readers to find your video content on Viddler — even if you didn’t post it on your blog — and even leave video comments for you.

What is Viddler?

Viddler is an online service that enables you to upload or record videos that can then be shared with others. It’s a bit like YouTube, only classier and used by people who want to communicate rather than show off entertainment-based content.

At least that’s my take on it.

Viddler uses Flash to capture video from a camera attached to your computer. It works great with my iMac’s built-in iSight camera and microphone, as well as the iMage camera I bought for traveling with my old PowerBook.

But you don’t have to capture video directly to Viddler. You can take an existing video file and upload it. Viddler supports .mov, .mpg, .wmv, .avi, and .m4v formats. You can’t, however, upload television shows or other material that’s likely to be copyrighted. Viddler doesn’t have the same deep pockets as YouTube and probably doesn’t want to be sued. Besides, you shouldn’t be sharing that stuff anyway.

Once content is on Viddler’s server, it can be set as private, public, or available to just your friends. (Like most social networking sites, you can create a network of friends to share videos you don’t want the general public to see.) You can also share your videos with others on other social networking sites or by embedding them in your blog or e-mail messages.

Getting Started

Viddler Sign UpOf course, to use Viddler, you need an account. Go to http://www.viddler.com/ and click the big green Sign Me Up button. Then follow the prompts to create a user ID and password. You’ll have to provide a real e-mail address, since Viddler will be sending you a confirmation e-mail. Once you get that e-mail, click the link in it to finish setting up your account.

You can now create or upload videos. I’ll discuss both of those tasks in future installments of this series.

Meanwhile, if you have a Viddler account, why not take a moment to share the info about it with us? Use the Comments link or form for this post to provide your Viddler username so we can check out some of your videos.

All Pingbacks Must Die

I’ve had my last pingback spam.

Anyone who has a blog knows that the comment feature is what makes a blog stand out from a plain old Web site. The comment feature is what makes a blog interactive, it’s what gives readers a chance to share their point of view or additional information about a topic. It gives them a chance to ask questions and get answers.

The comment feature works with the pingback feature. Pingbacks (which are often referred to as trackbacks) are machine-generated “comments” that are added to a post when another blogger writes a post that links to it.

Huh?

Discussion AreaOkay, think of it this way. You’re blogger A writing post 1. Blogger B writes post 2 that includes a link to post 1. A comment appears on post 1 that links back to post 2. This is all done automatically in WordPress (my blogging platform of choice) if — and this is a big if — you left the Allow Pings option turned on for post 1. You can find the setting for this in the Discussion area of the Write Post administration panel.

Unfortunately, the pingback feature also makes it possible for sploggers to get free links to their sites. A splogger builds content on a blog by stealing it from RSS feeds. Their goal is usually to get hits on their Web sites, which are full of Google AdSense ads, but they sometimes are part of a “link farm” that boosts search engine ranking.

The problem lately is that my sites have been attracting more pingback spam from splogging sites than real pings from legitimate sites and bloggers. These must be manually deleted, since my spam prevention software doesn’t seem able to catch them all. And frankly, I’m a little sick of spending each morning deleting six to twenty of these comments.

So I’m going to stop writing posts with the pingback feature enabled.

And if you’re having this problem on your blog, I recommend that you do the same.

How to Create a Gravatar

A few easy steps can get your custom image on gravatar-enabled blogs.

I originally wrote this article in April 2006 when I enabled my site for Gravatars. When I revised the site a few months ago, I temporarily removed Gravatar support. I’m now re-enabling it. In the meantime, Gravatar was bought out by Automattic, makers of WordPress. It seems to me that if you have a WordPress blog or comment on them, having a Gravatar and supporting the Gravatar feature would be a good idea.

That said, I reviewed this article and updated it as necessary to provide current information. Why not create your own Gravatar and see it appear on the Web sites you participate in?

If you read a lot of blogs, you’re probably already familiar with gravatars — custom images that represent certain commenters. These images are a kind of personal logo that identifies them and says something about their personality.

Here’s how gravatars work. A commenter creates an image suitable for a gravatar and uploads it to his account on gravatar.com. The gravatar is rated using pretty much the same ratings as the movie industry: G, PG, R, and X. These ratings are used by bloggers to set limits on the kinds of gravatars that appear on their sites — a gravatar with a G rating will appear everywhere while a gravatar with an X rating may not appear on many blogs at all.

Meanwhile, a blogger (like me) sets up her blog to enable it for gravatars. Then, when a commenter submits a comment, the blog’s gravatar plugin takes the commenter’s e-mail address (submitted in the comment form) and attempts to find a match at gravatar.com. If it finds a match, it displays the corresponding image. (The e-mail address is not used anywhere in the underlying page code.) If there’s no image on file, the plugin either displays nothing or displays a default image chosen by the blogger.

If you frequently participate in blogs by leaving comments for blog posts, you should consider creating a gravatar. Its easy and its free. Here’s how.

  1. Go to gravatar.com’s Signup Page.
    Sign Up at Gravatar.com
  2. Enter your e-mail address in the box and click Signup. A message appears, telling you that an e-mail message has been sent to your account.
  3. Check your e-mail. You should find a message from Gravatar with the subject “Welcome to Gravatar.”
  4. Click the URL link in the e-mail message. Your browser opens and displays a message confirming that you have successfully activated your account.
    Enter a Password
  5. Enter a password for your account in each of the boxes that appear and click Set Password.
  6. If you want to receive a Gravatar newsletter, click the button in the next screen. Otherwise, click No Thanks.
  7. Use your favorite graphics application to create an image suitable for use as a gravatar. For best results, it should be 80×80 pixels in size and not include a border. (Keep in mind that it might be displayed at smaller sizes.)
  8. Save the image as a JPG, GIF, or PNG image with an Internet-friendly name (no spaces or weird characters).
  9. Use your Web browser to open your My Gravatars page on gravatar.com. (You may need to log in to your account.)
    Your Gravatars
  10. Click the add a new one link.
  11. In the next screen, click My computer’s hard drive.
  12. In the next screen, click the Browse button. Then use the standard dialog that appears to locate, select and open the image file you created for your gravatar. The pathname appears in the File box.
    Upload gravatar
  13. Click the Next button. The file is uploaded and appears in the rating screen.
    Rate Your Gravatar
  14. Click the appropriate button to apply a rating to the Gravatar. Don’t lie; this is important. And remember that for maximum exposure, it’s good to create a gravatar rated G or PG.
  15. Your newly created Gravatar appears in the My Gravatars screen. Click it to select it for your e-mail address. When prompted, click the Confirm button. Here’s what it might look like when you’re finished:
    Selected Gravatar

You can repeat steps 10 through 14 to add additional images. You can then change your gravatar by simply selecting one of the new images. As you’ll see your gravatar changes globally wherever it’s used when you change it.

From that point on, your gravatar should appear whenever you post a comment to a gravatar-enabled blog — like this one.

Do you have a gravatar now? Show it off by entering a brief comment on this post.

RSSImport

A WordPress plugin to add links to RSS feeds.

On pages 165-166 of WordPress 2: Visual QuickStart Guide, Miraz and I discuss CG-Feedread, a plugin that enables you to list the titles (with links) of posts on another blog based on RSS feed content. We use the plugin on our >WPVQS.com Web site to list content from Miraz’s Mactips.info site and my An Eclectic Mind site.

I hate to admit it, but I never really liked that plugin. It came as part of a package and I was only interested in that one part. So today, while attempting to add the same feature to two of my WordPress-based sites, I looked for a different, simpler solution. And I found it: RSSImport by Frank Bueltge.

RSSIMport in ActionRSSImport is a one-trick pony. It enables you to add a list of posts from any RSS feed. There are four options: the number of posts to list, the URL of the feed, whether the list should include descriptions, and whether the post title should be truncated to 30 characters.

You install and activate the plugin like any other plugin. (You can refer to Chapter 7 of our book or consult the documentation that comes with the file if you need help.) Then place the following code in your template file — most likely sidebar.php — where you want the list to appear:

<?php RSSImport(10,"http://feeds.feedburner.com/mariasguides",false,false); ?>

The options go between the parentheses. In this example, I’ll pull 10 posts from the Maria’s Guides feed, exclude the description, and disable the 30-character limit on posts. The result looks like this on An Eclectic Mind. As you can see, I included a heading before the code so the list would blend in with the rest of my sidebar content.

And if you look on the Maria’s Guides site, you’ll see a similar list for an Eclectic Mind. (The two sites used to be one and they’re still somewhat “joined at the hip.”)

I recommend the plugin if you’re looking for a simple solution to list another blog’s posts. But if you want to list multiple blogs’ posts in the same list, CG-Feedread is probably a better solution.

Deleting Spam from Your WordPress Blog

Marking it as spam isn’t enough to get rid of it.

One of the things I like about WordPress is that it’s impossible to know everything about it. And today I learned something new.

I learned that the spam comments that I marked as spam had not been deleted from my WordPress database. They were just marked as spam so they wouldn’t appear in posts.

How did I discover this? I had to export all blog posts from An Eclectic Mind to a special WordPress-compatible XML file that contained all blog posts and comments. I had to weed out all the posts and comments I didn’t want to import into my new Maria’s Guides site. And that’s when I found all the nasty spam I’d marked for the past 4 years.

Now don’t think this was all of the spam. It was only the spam that was marked as spam using WordPress’s comment moderation feature. When the comment spam situation got out of control, I enlisted the help of the Bad Behavior and Spam Karma 2 plugins. Bad Behavior prevents potential spambots from posting comments at all. Spam Karma catches 95% of the spam that gets past Bad Behavior. I’m left with less than 10 spam comments a day. Not bad when you consider that Bad Behavior alone caught 17,067 spam attempts in the past seven days. The way I see it, anyone with a relatively well-Googled blog who doesn’t use at least one of these tools is doing a lot more comment moderation than they need to.

So there I was, halfway through the process of deleting non-book-related posts and their comments from an XML file, when I realized that much of the file’s contents was spam that wouldn’t appear when I imported it anyway. And that’s when I started thinking about how much database space was devoted to this spam.

The DB-Manager Plugin

Database ContentsI use Lester ‘GaMerZ’ Chan’s DB-Manager plugin. This plugin puts MySQL database features into the WordPress administration panel. This is a must-use for anyone who needs to get into their database and learn more about it or make changes to it.

So I went into the plugin’s interface and learned that my blog had 1900+ comments. I knew that only 1400+ comments were actually appearing in the blog. That made 500+ spam entries sitting in my database, taking up disk space and making my backups much larger than they needed to be.

(Note: The screenshot here shows the database contents after removing the spam. If I’d known I was going to write about it here, I would have taken more screenshots.)

I wanted them out.

Help on the WordPress Forums

I found help on the WordPress forums. They really can be helpful if you enter the right search phrase.

The topic was Support › deleting over 10,000 spam comments without using moderation page. The story was, this poor soul had left his blog alone for a week and, when he returned, found 10,000 comments on it. He wanted to delete them.

A member named bindanaku came to his rescue with a MySQL query:

DELETE FROM wp_comments WHERE comment_approved='0'

This assumes that you want to delete all comments that haven’t been moderated. This was not the case for me. I wanted to delete all comments that had been moderated as spam. I assumed that the correct query for my situation would be:

DELETE FROM wp_comments WHERE comment_approved='spam'

I was right.

Back to DB-Manager

Enter a MySQL QueryI went to the DB-Manager administration panel and clicked the Run SQL Query button. That gave me a window where I could enter my query, as shown here. When I clicked Run, I got a message that the query was successful.

Sure enough, when I checked the Database info (see previous screenshot), I could see that 500+ comments had been removed from the database. But the table size was the same.

I used DB-Manager’s Optimize DB feature to optimize the database. That dropped about 400K from the table size.

I should note here that if you’re more familiar with editing a MySQL database, you can do the query with your normal editing tool. I don’t mess with my MySQL database much. I’m always afraid of screwing it up. (Call me a wimp — I don’t care.) That’s why I use DB-Manager.

Conclusion

While all this might seem like a lot of work to get rid of 400K of file size, the situation could be worse on your blog. My blog has about 1500 posts spanning about four years. I’ve been using Bad Behavior and Spam Karma for at least two of those years. So the majority of these old spams were from very old posts. If you don’t use any spam protection software and are manually moderating comments, you could have far more of these spam comments in your database. And since many of them were lengthy listings of porn and ringtone and other URLs, they were quite large in size. If you have a lot of these in your database, it could be taking up a lot of space — perhaps even more than your actual blog posts.

Do I recommend going through this process? It’s up to you.

Web Tools: Color Wizard

An online tool helps a non-designer pick a color scheme for a new blog.

I am not color blind. I know I’m not. I see colors and I know when certain colors look good together. But I can’t, for the life of me, come up with a color scheme on my own.

Color, of course, is a major part of any Web site’s look and feel. So when I found a blog post months ago that listed a few online color tools, I bookmarked them for later use. On Saturday, one of them came in very handy as I decided on a color scheme for my blog’s new look.

The Color WizardThe Color Wizard is a Flash application by Donald Johansson. This excellent online tool helps you find colors that work well together.

From the Color Wizard page:

The color wizard lets you submit your own base color, and it automatically returns matching colors for the one you selected.

It returns a set of hue, saturation and tint/shade variations of your color, as well as suggests color schemets to you, based on your color’s complementary color, split complementary colors, analogous colors and other variations. The color wizard also has a randomize function that lets you generate color schemes you might not have thought of on your own.

It’s the randomizer that helped me. I just kept clicking the Randomize button until I found a few schemes I liked. When I had about eight of them, I went back and reviewed each one, eliminating the ones I liked less until I had one I liked a lot. I then picked the blue color from the theme and generated another scheme from that, so I could get the colors I planned to use for my links.

What was also handy for me was the print feature. Although it’s not obvious on the application, if you right-click the Flash app, a Print option appears in the shortcut menu. I used that to print my two color schemes on my color printer. So not only can I visualize what the colors look like — or at least approximately what they look like; I don’t have a great color printer — but I have a document that clearly lists all the hex codes for all the colors.

I’m so pleased with the results that I clicked the Donate link at the bottom of the Color Wizard and used my PayPal account to send the developer some lunch money. (As usual, I urge everyone who uses great free software like this to thank the developer with a donation or at least a visit to his advertiser’s sites.)

Looking for a color scheme? The Color Wizard is a great place to start.

Fixing Post By E-Mail In WordPress 2.2

And some other information you might find useful.

I finally upgraded my personal blog to the latest version of WordPress, which is version 2.2.2 (as I write this). In addition to breaking a handful of my plugins — not a big deal, since I was able to replace just about all of them with newer, better versions — it also broke WordPress’s post by e-mail feature, which we discuss on pages 64-66 of our WordPress book.

The Post by E-Mail Feature and How It Broke

If you’re not familiar with this feature, you might want to be. It’s pretty cool. It enables you to send an e-mail message to a special account you set up for WordPress to check. When WordPress finds a message there, it automatically posts the content of the message to your blog, using a predefined category that you choose. The message subject becomes the post title.

In WordPress 2.2, WordPress simply stopped seeing and importing the body of the message. As a result, you’d wind up with properly titled but otherwise empty post.

The Fix

Some research on WordPress.org uncovered a post which explained the problem and offered patch code for the class-pop3.php file. This file, which resides in the wp-includes folder of a WordPress server installation, is responsible for processing posts by e-mail.

I manually replaced the bad code with the new code in my file and tested the results. It worked fine.

Rather than fiddling around with code like I did, you can simply download the revised file here. UnZip it and use it to replace your current class-pop3.php file. (If you’re smart, you’ll save a copy of your current file — perhaps by renaming it right in the folder in which it resides — before replacing it.)

This file definitely works on my WordPress 2.2.2 setup. It might not work with earlier or later versions of WordPress or on your setup if it has been heavily modified, so try it at your own risk.

A Neat Trick

While I was researching the problem, I picked up a neat trick in the WordPress Codex.

If you use post by e-mail, you probably know that your e-mail messages won’t be posted unless WordPress checks for mail. As we wrote in our book (on page 66), there are at least two ways to do this: manually by opening a specific Web browser page or automatically using a plugin.

But there is another way to automate the process and it’s pretty easy for WordPress novices who aren’t afraid to roll up their sleeves and modify a template file. Simply include the following code in your theme’s footer.php file:

<iframe src="http://<em>yourblogdomain</em>/<em>wordpressinstalldir</em>/wp-mail.php" name="mailiframe" width="0" height="0" frameborder="0" scrolling="no" title=""></iframe>

This forces WordPress to check for mail every time someone loads any page on your site.

The drawback to this is that if your site is very busy, your server will be checking pretty often for e-mail messages. But it seems to me that you could include the same code on another template page that’s used less often, perhaps category.php (if present) or archive.php or page.php.

Hopefully, you’ll find this information useful. As usual, comments are welcome. Use the Comments link or form below to share your thoughts with me and other visitors.

Google Sitemap Article Now Online

Help Google index your WordPress site by setting up a sitemap.

My most recent article for Informit.com is now online: “Add A Google-Compatible Sitemap For Your WordPress Blog.” The article explains the steps you need to follow to set up a WordPress plugin that will automatically generate and update a Google-compatible sitemap. This can help Google index your site and improve your Google rankings.

Gila Monster

My first Final Cut Express video project.

After spending three days going through a tutorial to learn Final Cut Express HD, I was ready to create my first video project. I’m sharing it with blog readers so you can see how much effort a person can expend on 25 seconds of video.

About the Project

This particular project features a Gila Monster (pronounced “heela monster”), which is a rather large lizard that can be found in the Arizona desert. If I’m lucky, I see one or two of these in a year, so they’re not exactly common. They are, like so many things in the desert, poisonous, so you don’t want to get too close. But since they’re not exactly fast and they’re definitely not aggressive, you can get photos of them in action if you have equipment with you.

On a backroad trip with Mike and some friends, we happened to come upon one croassing the road. I had my video camera with me and whipped it out to capture some pretty decent footage. This Final Cut Express project cuts out the boring shaky bits, replaces our silly comments with music, and adds opening and closing titles. This is the first in a series of short videos I hope to add to wickenburg-az.com, so make the site more interesting to visitors.

But this is also an experiment to check out video formats and Final Cut Express’s export feature. I had great success when exporting to QuickTime movie format, for iPod, and for Apple TV. But the Windows Media Player export didn’t work right at all and the AVI format was extremely poor quality, despite the file size, so I’m not going to distribute them. I just spent another few minutes using the iPod version of the file to create an e-mail version using QuickTime’s Share command. That worked best of all for the Web view of the file. Only 3.3 MB (which is smaller than the iPod version, and it looks pretty good.

Getting it Online

XHTML purists will tell you that the EMBED tag is a no-no in Web development. I think it has something to do with Internet Explorer which, for some reason, can’t interpret XHTML and CSS like the rest of the Web browsers on this planet.

So this project is also an experiment to see if the QuickTime Embed plugin for WordPress will work. If you’re reading this article shortly after I put it online and there’s no QuickTime movie below (or if the whole site is messed up), it’s because I’m trying this out and debugging. (Check in again in about 30 minutes.)

That said, here’s the movie with a Poster movie. I think I’l leave the iPod file for wickenburg-az.com distribution.

Why WordPress.com is Virtually Spam Free

A great article on Plagiarism Today.

As those of you who read this site regularly should know, I’ve been pretty POed about the blog spam and splogging situation. I subscribed to the Plagiarism Today feed because of its excellent articles about copyright and the fight against feed scraping by sploggers.

Today’s article about WordPress.com was an especially good read. From Why WordPress.com is Virtually Spam Free on PlagiarismToday:

It seems as if nearly every major free blog hosting service has been either overrun or nearly overrun with spam. However, one services stands alone, a relative oasis of spam cleanliness, Automattic’s WordPress.com . Despite being just as free as its competitors and placing few restrictions on registration, WordPress.com has not endured the spam avalanche that other services have.

The article author, Johnathan Bailey, interviewed WordPress founder Matthew Mullenweg to learn why WordPress.com is so spam-free. The article is enlightening and highly recommended.