Dev Blog
How To Add Numbers To Your Comments in 3 Easy Steps [WordPress Tip]
Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941334.

In the past few weeks I’ve had a few people email me and ask me how I get the numbering to show up on my comments. It’s really more of a PHP question then a WordPress question, but it’s quite simple. There may be plugins which do this for you, but anytime I can have a simple fix and avoid the overhead of a plugin, I’m happy. The following tutorials is for someone with no PHP experience and basic HTML/CSS knowledge. Here’s how to number your comments in three steps.

Example:

Step 1

Locate and open your theme’s comments.php file. Theme files are found in wp-content/themes/themename/. In your comments.php file you’ll be looking for the following code:

1
<?php if ($comments) : ?>

Directly after that line, type <?php $i = 1; ?>, so that it looks like this:

1
2
<?php if ($comments) : ?>
<?php $i = 1; ?>

What were doing here is saying ‘If there are comments, set the variable “i” equal to “1″‘. This will be the number for your first comment. If you set this to something else, like 15, your comments would begin numbering at 15.

Step 2

Next, look for the following code:

1
<?php foreach ($comments as $comment) : ?>

Any code that found in between the above foreach code and a special endforeach code will be run for each individual comment. It is in this block of code that you’ll need to enter the following code:

1
<?php echo $i; ?>

What this does is tell the browser to display the value of the “i” variable, which for the first comment would be “1″. So where would you put this? You position this in the HTML of your comments so that it is displayed in your desired location. Treat the above PHP code as if it were a single number. You can surround it with any HTML and CSS that you want.

For example:

1
2
3
4
<?php foreach ($comments as $comment) : ?>
<div class="comments">
<strong> <?php comment_author_link() ?> </strong> said: </cite><span class="commentnumber"><?php echo $i; ?></span>
...

Step 3

The last step is to increment the variable so that each comment has a higher number then the previous one. To do this, locate the following code:

1
<?php endforeach; ?>

Directly before that line of code, enter <?php $i++; ?>, so that it looks like this:

1
2
<?php $i++; ?>
<?php endforeach; ?>

$i++ increments the value of the “i” variable. Since this is done for each (thus the “foreach”) comment, each successive comment will have a higher number then the last one.

Done

And that’s it. In three steps you’ve just added numbers to your comments. It’s quite simple. Numbered comments are useful because they let you easily reference previous comments. Now you can have them on your blog!

Read more...
 
RSSless WordPress Plugin Released
Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941309.

I’m happy to announce the release of RSSless, a new WordPress plugin. RSSless is a WordPress plugin which allows you to hide specific content in your posts from RSS readers. This is helpful for bloggers who embed videos, images, or other content which doesn?t display or embed correctly in RSS readers. Rather then having RSS readers get blank content, you can simply replace it with customizable message, such as ?Please view the original article to watch this video.?

RSSless uses WordPress? built in short code API. Simply surround the content you want to hide from RSS readers with the [rssless] [/rssless] short code tags.

I created RSSless because of a specific need I had. Since it seemed to work pretty well, I’ve decided to release it to the public.

I’ve also created a video review of RSSless which you can view here:

Please view the article in your web browser to see this video. (PS: This message was created by RSSless!)

You can download or read more about RSSless here. Please leave support questions for the plugin on its official release page.

Read more...
 
<< Start < Prev 1 2 3 4 5 6 7 8 9 10 Next > End >>

Results 1 - 6 of 125

How To Add Numbers To Your Comments in 3 Easy Steps [WordPress Tip]

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941334.
In the past few weeks I’ve had a few people email me and ask me how I…     Readmore

RSSless WordPress Plugin Released

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941309.
I’m happy to announce the release of RSSless, a new WordPress plugin. RSSless is a WordPress…     Readmore

Website Translating Even If You Don?t Know What Language It?s Written In [Online Tips]

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941263.
Have you ever come across a website or comment that was written in another language that you…     Readmore

Review: Apprise RSS Reader

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941250.
I’ve been looking for a new RSS reader ever since I bought my Macbook a few weeks…     Readmore

Admin Favicon v1.3 Released

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941243.
I just released version 1.3 of Admin Favicon, a WordPress plugin which adds a custom favicon…     Readmore

Freelancers: Payment Refused. Now What?

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941230.
sitedown.png I’ve been doing freelance work for some time now. It’s generally…     Readmore

WordPress 2.6: Easy Upgrade

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941203.
If there’s one thing I hate doing it’s upgrading the version of WordPress I’m using. I know…     Readmore

Photographing Fireworks

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941201.
I’ve never been much of a photographer, but a few months ago I bought a Canon…     Readmore

dealdotcom
Earn $$ with WidgetBucks!