Random Hadith

Update: If you wish to use the random hadith service, visit this page. The plugin is discontinued but may be redeveloped in the future.

Random Hadith Plugin. Random Hadith

Random Hadith is a nice script that was programmed by Kemas Yunus (coincidence he has the same second name as me). :) Anyway I’ve been using it on a few websites and its really good because of the fact that it’s a simple PHP include: This new service will allow you to put a random Hadith on your website.

Features:

• Displaying a Hadith of Prophet Muhammad (SAWS) SAW (pbuh) randomly on your website. It is useful when:

• You want to know more about the Islam and its messages.

• You want something that help you remember and denote the way Prophet Muhammad (SAWS) SAW (pbuh) lived his life.

• You have a website which provides information about Islam and other things related to it. Why? Because, the visitors of your website will get an added value when they browse the website, especially on daily basis.

• Free. Insha Allah (SWT), it will cost you nothing for using this service, today and also in the future. I made it just for fun. I hope that everyone could enjoy the service and have fun with it as much as I do.

It’s easy to install and use. What you need to do is just copy and paste a little PHP code anywhere on your website. So all I did is inserted the following code into my sidebar.php to make it built into my website:

<li><h2><?php _e(’Random Hadith’); ?></h2>
<ul>
<?php include(’http://www.kyantonius.com/hadith/quotation.php’); ?>
</ul>
</li>

So you can use this and it works just fine. However I thought what would be even cooler would be to actually make this into a plug-in that could be just activated by any user.

My lack of knowledge in programming doesn’t help but I do intend to make this plug-in work just by activation. Currently I’ve programmed a really simple script that works, but still requires editing of the Sidebar.php file.

Steps to install:

1. Download the plug-in (ZIP) and extract.

2. Open your Sidebar.php or any template file and add the <?php random_hadith() ?> to where you want the Hadith to show.

3. To decorate the script just add the <ul> and <li> tags (or any other appropriate tags you want).

4. An example of the code you can insert into the sidebar:

<li><h2><?php _e(’Random Hadith’); ?></h2>
<ul>
<?php random_hadith() ?>
</ul></il>

Use this method to prevent your page breaking when you de-activate this plugin

After this upload the plug-in to your wp-content/plugins directory and activate it in the admin panel. Your Random Hadith should show up then.

The advantage of using this plug-in is that you can put the <?php random_hadith() ?> anywhere on the website! You can even have it after every post.

Special thanks to Kemas Yunus Antonius for the Random Hadith Script, and Jamie Talbot for helping with the Plugin Programming!

You can now find the plugin at:

That’s all so far!

Usayd Younis

// Changelog \

0.1-0.2b - Initial plugin testing (non-functional).

0.3a - First release of working plugin. Required modification of sidebar.php and the moving of the < ?php wp_meta(); ?>.

0.4b - Secondary modification of the plugin (non-functional).

0.5-0.9a - Third modification works with errors (Missing argument 2 for add_action() )

1.0 - Stable version, Working modification, final version without modificiation of < ?php wp_meta(); ?>.