300 posts on my blog – not a very small number

Confuscius said “It does not matter how slowly you go so long as you do not stop”. Interesting is that I learned about this quote just few minutes ago and when I knew about it, I thought slowly (without stopping) I have published 300 blog entries on this blog.

A few days ago, when I published my latest blog How I have solved the “The plugin generated xxxx characters of unexpected output during activation problem…” I did not notice that it was my 300th published post on this blog. I noticed it later and tweeted about it. Few friends also responded me with congrats. Thanks to all of them.

Today after reading the quote of the Confucius, I thought it is worthy to write a blog about my 300th blog post. Why? What’s the specialty of 300? Continue reading →

Searching and retrieving yahoo answers in PHP

I am working on an WordPress autobloggin plugin where I had to search yahoo answers site for any keyword and post the answers in WordPress. After checking their site, I see it is very easy now as they provide API for the questions and answers. I do not know when they introduced API for Answers but I do remember during my last check (quite long time ago), they did not have any API and scrapping was the only way.

Their API for searching and getting answers is very simple and easiest! However, for the better handling of my project, I have mad a class to find questions by any given keyword and then retrieve the answers of any specific question by question ID.

How to use?
Continue reading →

How to avoid or skip Trash in WordPress

If you come to this post, it is highly possible that yo are already annoyed by the Trash feature of WordPress that was introduced in its version 2.9.

I personally find it very helpful in live sites but I believe no one than me is annoyed most by it on development site. However, WordPress is always sweet and its programmers has longer nose. So they put a configurable option to adjust it.

All you need is to add a line in wp-config.php file. You will need to add a constant like:

define('EMPTY_TRASH_DAYS', 0);

That’s it. The trash button from your WordPress will just elope and your old loving Delete button will come back:).

One more thing, by default WordPress keeps stuffs in trash for 30 days. So if you want to keep the posts in Trash for 3 days, write like:

define('EMPTY_TRASH_DAYS', 3);

Tips for WordPress Cron functions

WordPress provides some nice APIs for executing unattended scheduled tasks without relying on any external cron! Usually, we need to create a cron from our control panel / systems! However, if you implement built in cron features of WordPress, you gain better portability of your WordPress site!

However, it has a great limitation! This cron fully relies on site hits! WordPress triggers its cron functions after someone visits the site! When anyone visits your site, WP checks if any cron are supposed to be executed on or earlier of that moment! If no one visits your site, WordPress will fail to execute your tasks!

In this blog, I am going to show two tips that may be helpful while you work with wp-cron functions!

Continue reading →

Header Image Rotator for Twenty Ten theme of WordPress 3.0

WordPress 3.0 is still in RC1. I have already upgraded this blog to this version. I can’t but  simply love the new theme ‘Twenty Ten’ which is default in WordPress 3.0. It is super simple theme.

In this theme, there is option to use custom header image. From the admin panel you can select the header image. However, all of the default banners looked interesting to me and I have also uploaded some of my own shots. I wanted to show them all.

Keeping that in mind, I made this simple plugin, Twenty Ten Image Rotator. Having this plugin installed, you can show all images on the header. Single banner each selected randomly on each page load.

I believe if you love Twenty Ten theme, you will love this plugin too :).

Download from WordPress Plugin Repo

WordPress Category Widgets plugin – display different widgets for different categories

Today, I have developed another plugin for WordPress which I named ‘Category Widgets’ plugin and as usual nothing more peaceful rather than sharing with the community.

Using this plugin, you can display a text widget for any specific category and/or its sub-categories. For example, you want to show different sidebar banners based on different category. It is easy using this plugin. Just create a new widget and select the category.

I have found another plugin for almost the same purpose. That plugin lacks of capability of displaying in the subcategories. That mean it does not work for the sub-categories of the selected category. In this plugin, I have made that feature and also optionally you can disable that feature too.

Requirements:

  1. WordPress 2.8+

Download:

Continue reading →

WordPress Plugin :: Adult Post Marker

Hey! Here is my another wordpress plugin. Using this plugin, you can mention a post as inappropriate for non-adult and ask viewer his/her before showing the content to him. If age given age is below your Minimum Age requirement (configurable from settings page), then the viewer can’t see the content.

Moreover, a cookie is set so that persistent tries also restrict from seeing the content. Allmost everything of the plugin can be reconfigured from plugin configuration page.

This plugin is tested with WordPress 2.6.2 and 2.7

Download

Feedback is appreciated.

WordPress Read/Hit Counter Plugin Update (v1.1)

As some of users of my plugin, wordpress read counter, requested me to release an update so that they can show hit counter along with post. Few days ago, I have made the necessary update but I forgot to release it.

Click here to download

The installation steps are available in the previous post. I am just showing how to show the counter with post.

For showing the counter you need to edit the template file. You need to put the following line anywhere in the theme/template to show the counter.

< ?php if(function_exists(‘rc_showread’)) echo rc_showread();?>

Showing counter on homepage:
Go to theme editor. Click on index.php file and open it. Put the above line where you want to show it.
here is the excerpts after applying this in wordpress default theme:
——————
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to < ?php the_title_attribute(); ?>”>< ?php the_title(); ?></a></h2>
<small>< ?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –> < ?php if(function_exists(‘rc_showread’)) echo rc_showread(); ?></small>
</div>

——————-

Showing counter on post details (single post):
Go to theme editor. Click on single.php file and open it. Put the above line where you want to show it.
here is the excerpts after applying this in wordpress default theme:
——————-
< ?php } edit_post_link(‘Edit this entry’,”,’.’); ?>
< ?php if(function_exists(‘rc_showread’)) echo rc_showread(); ?>
——————-

Don’t forget to clear caches if you use any caching in your blog to see the effect.

My first plugin in wordpress plugin repo

May be nothing to be exicited. But its still a moment to remember. Today I have published my latest plugin in WordPress plugin repository. Though I have made two more open source plugins, I did not put them in the repo. But I wanted to put my latest plugin (Blog Post Reordering) to the repo to extend its users. As a result, yesterday I have applied for SVN access and today I got approval.

I have immediately uploaded the files. Now just waiting to get users’ feedback. As I have released RC1 of that plugin, I am waiting for users’ feedback to fix bugs. After fixing these, I will release the final 1.0.

Click here to visit the page in repo.

WordPress Blog/Post Reorder

Until this plugin takes birth, the blog posts of WordPress were arranged on post’s date/time basis. The latest post will be in front and the earlier posts will sink.

From a few days, I was planning about this plugin. I am excited at this beta release of it.

Usage:
Using this plugin, posts can be reordered or reorganized. Now you can set how blog posts should come one after another. By default, the posts are displayed on time basis. The latest created post comes at first. But now you can set the order in a array of ways. You can also define custom ordering. Continue reading →