Archive for WordPress

Separating Pingbacks and Trackbacks from Comments in Wordpress

This isn’t something blogs do all that often, but ever since I saw how JohnTP separates his pingbacks and trackbacks from his regular comments I’ve wanted to take the time to figure out just how to do that myself.

From the user’s perspective, separating pingbacks and trackbacks provides a nice, clean look that doesn’t break up the flow of reader comments. As such, I hope every blog seriously considers separating pingbacks and trackbacks from regular comments. If you’re still having doubts I’d like to make the choice easier for you: the steps below show you how to separate comments from pingbacks and trackbacks.

First, you will need to modify the comments loop in your template’s comments.php file and add the following code:

<?php $comment_type = get_comment_type(); ?>

This will make the $comment_type variable available so that you can place an if () statement to determine if the comment is a comment, pingback, or trackback.

Next, you’ll need to add an if () statement inside of your comments loop so that only normal comments are shown. To do this you’ll need to wrap all of the code inside of the comments loop between:

<?php if ($comment_type == 'comment') { ?>

and

<?php } ?>

Now that you’re only showing normal comments, you’ll need to make a copy of your comments loop so that you now have two comment loops, one right after the other. The only change you’ll need to make in the second loop is to change:

<?php if ($comment_type == 'comment') { ?>

to

<?php if ($comment_type != 'comment') { ?>

Now all you have to do is style the second loop to your liking. For my template I stripped out the excerpt text and added the following code to print out an appropriate indicator for pingbacks and trackbacks:

<?php
if ($comment_type == 'pingback') {
    echo "Pingback";
} else if ($comment_type == 'trackback') {
    echo "Trackback";
}
?>

Now that you know how to separate your regular comments from pingbacks and trackbacks what are you waiting on? Go separate them already!

Tags: , , , , ,

Did You Remember to Update Your Wordpress Time Zone Offset for DST?

When I published yesterday’s blog post I realized it was posted an hour later than it was supposed to.

I had set the post to publish at a little after 6am Eastern, but instead it was published at a little after 7am Eastern.

This lead me to believe there was some sort of Wordpress DST bug that needed to be patched, but thanks to this post it turns out that Wordpress has never had any code to adjust for DST.

As such, if you’re like me and forgot to update your time zone offset then it’s about time you go ahead and do it, and stop living in the past already!

To update your time zone offset go to your Wordpress administration interface and go to the Options menu. If not there already, ensure you’re at the General tab. At the General tab update your time zone offset to the appropriate number. If you’re on Eastern Time, like me, then update this from -5 to the now correct -4. If you’re in a different time zone then you’ll need to update accordingly.

Someone’s already requested Wordpress add code to handle DST changes, so maybe this won’t be a big issue in the future.

What are you waiting for? Come on ahead into the future with the rest of us already!

Tags: , , , , ,

Show Unread Comments - New Wordpress Plugin

I’m proud to announce the release of my first Wordpress plugin, Show Unread Comments.

Plugin Features

This plugin provides two different methods to help your readers keep track of comments they have yet to read.

The first method shows a comment status indicator next to each comment so that the reader can quickly identify if they’ve read the comment or not.

Unread Comment
Indicator
Read Comment
Indicator
Unread Comment Read Comment

The second method lists unread comments on the sidebar for your readers to see a short list of recent unread comments.

List of Unread Comments

If you’re like me and have a hard time keeping up with comments then you’ll love this plugin, as you’ll be able to easily see if you’ve already read a specific comment on a given post, and this plugin will be especially helpful for blogs that use threaded comments.

Getting the Plugin

To get the plugin go on over to the Show Unread Comments plugin page and follow the instructions to download and integrate the plugin into your blog.

If, however, you’re impatient then you can start downloading the plugin now using this Show Unread Comments plugin download link.

Full Customization

This plugin allows you to fully customize the look of the status indicators and list of unread comments, so make sure you go to the Show Unread Comments plugin page to full details on how to customize the plugin.

Trouble with the Plugin?

If you have any trouble with the plugin or have a question leave a comment below or visit my contact page to get in touch with me.

Thanks

I’d like to thank Brett Taylor, as I based this plugin on his Smart Unread Comments plugin, and Show Unread Comments wouldn’t be nearly as good without using his plugin as a starting point.

Tags: , ,

Using Wordpress to Maintain Blog Consistency

When I started this blog a couple of weeks ago my first goal was to begin building a readership base. This is obviously the key to a blog’s success, so this goal shouldn’t surprise any of you.

To help accomplish this goal I wanted to, at a minimum, make one quality post per day that will be relevant to most people interested in web development, internet marketing, Wordpress, and the like.

Thankfully it didn’t take me long to discover a Wordpress posting feature I’ve been missing out on since I first started using the software in December of 2005: Post Timestamp.

How I missed out on this feature for so long is beyond me, so I figure this post is likely relevant to a lot of people out there, even if you’ve been using Wordpress for an extended period of time.

By using this feature you can set a post to be published at some date in the future, and I’ve been using this feature to help me keep to my goal of one quality post per day.

Using this feature is simple: under the Post Timestamp menu in the Wordpress post options click the Edit timestamp checkbox and set the date and time to some time in the future. Once you’re finished with your post click Publish like normal, but instead of your post appearing automatically it’ll be published at the date and time you entered.

The greatest part about this feature is that your post will be published regardless of what you may be doing at the time. In my case the posts are published while I sleep. I figure that by getting each post out early in the morning it’s likely to be seen by more people during the day, so what better time to have the post publish then while I’m asleep? (OK, I’ll admit it: I think it’s very cool that I can sleep and update my blog at the same time.) This helps me keep posts coming out on a consistent basis, and posting consistency is something all blogs can reap benefits from.

You can probably think of a million ways in which you can use this feature to update your blog while you’re doing something else, and a few things quickly come to mind: you’re on vacation or you keep a small collection of posts available for publishing in the event you don’t have anything to write for the day, or you simply want to space out your posts so you don’t bombard your readers with a flurry of posts.

I hope you enjoyed reading this post as much as I did publishing it while I’m getting some much needed rest.

Tags: , ,

Optimizing Kontera ContentLink Ads in Wordpress

If you’re running Kontera’s ContentLink service on a Wordpress blog or website then you’ll want to tell Kontera where to place the in-text advertisements so that the advertisements only show up in the content of your posts and pages.

You must ensure you do this because there’s nothing worse than visiting a website with in-text advertising in non-content portions of the site like headers, navigation menus, and footers. By using the tip below you can ensure your website is free from this irritating eyesore.

To tell Kontera where to place in-text ads you can surround your content with a <div> HTML tag with the class name of KonaBody, and by modifying your Wordpress template you can quickly integrate this tag into your blog or website.

Integrating this tag into your Wordpress template is easy: simply place all calls to the_content() in your Wordpress template between <div class=KonaBody> and </div> tags. Make sure you modify all calls to the_content() in your index.php, single.php, and/or page.php template files to ensure your in-text advertisements show up in only the appropriate places.

Once you’re done modifying your template you won’t have to worry about seeing in-text advertising in non-content portions of your website ever again. As a side bonus, Kontera will also have an easier time of optimizing their advertisements for the portions of your website that matter the most: the content.

Oh, and if you haven’t done so already, make sure you sign up for Kontera’s ContentLink service.

Tags: , , , , ,