Comments Pagination – Wordpress – Bug Fixed!

Actually, I did not create a plugin but I wrote a code snippet that did this job for me.

Add these lines to comments.php in your active theme folder.

$comments_per_page = 5;
global $post;
$total = $post->comment_count;
if($total > 0) {
$apage=isset($_GET['apage']) ? intval($_GET['apage']) : 1;
$comments=array_slice($comments, intval(($apage-1)*$comments_per_page),intval($comments_per_page));
}

Insert this code right after if ($comments) statement

$commentCounter = (($apage-1)*$comments_per_page);
$from_page = $commentCounter+1;
if($apage == 1) {
$to_page = $comments_per_page;
if($total < $to_page) {
$to_page = $total;
}
}
else {
$to_page = $from_page + $comments_per_page - 1;
if($to_page > $total) {
$to_page = $total;
}
}

Insert this line where you want page links to appear in comments.php.

<?php echo paginate_links( array(
'base' => add_query_arg( 'apage', '%#%#comments' ),
'format' => '',
'total' => ceil($total / intval($comments_per_page)),
'current' => $apage
));

I think this is it. It should work. Give it a try and share your feedback via comments.

Flickr photos in post using shortcode

Shortcodes are awesome! This time I am showing photos from my flickr account to wordpress post.

Content from X'Mas in NY

Google Shared Items in post using shortcode

New in WordPress 2.5 is the Shortcode API, a simple set of functions for creating macro codes for use in post content. I thought let me see how it works! I am showing my google reader shared items within a post using shortcode.

2010: A Theme Odyssey
From: WordPress Development Blog

WordPress 2.9
From: Lester Chan's WordPress Plugins

Create a Simple Slideshow Using MooTools
From: David Walsh :: PHP, CSS, MooTools, jQuery, and Everything Else

Design v5
From: CSS-Tricks

Wordpress 2.5 RC1

Trying a WP 2.5 stable version (2.5-RC1). It’s awesome!

Joomla or Wordpress?

Joomla is primed to be the next favorite Open Source Software, or that it already is? More on WordpressGarage.com

Migrate Tags from UTW Tags to Wordpress 2.3 Terms

I was running wordpress 2.0.5 since 2 years and did not get time to upgrade to Wordpress 2.3.

So I decided last week to upgrade to Wordpress 2.3 and I did. I upgrade the same way how wordpress advice us here.

After installation, I did notice it has migrated my categories tables to wordpress 2.3 Terms tables but nothing migrated from Tags tables. I was surprised! Did I make any mistake? Then it comes into my mind, it is Ultimate Tag Warrior plugin, which has created those tables for me not Wordpress.

Now I had to migrate those tags from Tags table to Terms tables. So I wrote a script that does that job for me. I thought let me make that available to you, if someone would like to extend the script and build a smart plugin! read more »

Post videos to wordpress blog with a single click

Now it is so easy to add videos from 1000s of video sharing sites to WordPress blog with the Post to WordPress button

To make this video embedding process easier Vodpod introduced a “Post to WordPress” browser tool that works with hundreds of video sites and makes it easy to grab a video and publish it to your WordPress blog.

Microsoft's bid for Yahoo! good for PHP?

Tonny Bibbs has some questions regarding this deal. How does this going to affect PHP?

There are some news long time ago regarding “Zend and Microsoft partnered over a year and a half ago to improve native support for PHP under Windows and IIS”.

Maybe this is a good thing for PHP? Maybe there will be zero impact? What about technologies at Yahoo!?

Read more

Never lie to your Mom

I got an email from my friend this morning. I thought let me share it with you…

Mom came to visit her son Kumar for Dinner…..who lives with a girl roommate Sonia.

During the course of the meal, his mother couldn’t help but notice how pretty Kumar’s roommate was.

She had long been suspicious of a relationship between the two, and this had only made her more curious. Over the course of the evening, while watching the two interact, she started to wonder if there was more between Kumar and his roommate that met the eye.

Reading his mom’s thoughts, Kumar volunteered, “I know what you must be thinking, but I assure you, Sonia and I are just roommates.”

About a week later, Sonia came to Kumar saying, “Ever since your mother came to dinner; I’ve been unable to find the silver chutney jar. You don’t suppose she took it, do you?”

Kumar said,”Well, I doubt it, but I’ll email her, just to be sure.”

So he sat down and wrote:

Dear Mother:

I’m not saying that you ‘did’ take the chutney jar from my house, I’m not saying that you ‘did not’ take the chutney jar. But the fact remains that it has been missing ever since you were here for dinner.

Love, Kumar
read more »

Letters a, b, c & d

Some emails arrived in my Yahoo! Account are funny and real…

Letters ‘a’, ‘b’, ‘c’ & ‘d’ do not appear anywhere in the spellings of 1 to 99
(Letter ‘d’ comes for the first time in Hundred)

Letters ‘a’, ‘b’ & ‘c’ do not appear anywhere in the spellings of 1 to 999
(Letter ‘a’ comes for the first time in Thousand)

Letters ‘b’ & ‘c’ do not appear anywhere in the spellings of 1 to 999,999,999
(Letter ‘b’ comes for the first time in Billion)

And

Letter ‘c’ does not appear anywhere in the spellings of entire English Counting