Posted on March 31, 2009 by Atif
Filed Under Off Topic
Due to my exams starting from tomorrow I wont be available online for a week. So please don’t stop following this blog. I’ll resume writing new posts from Sunday.
In the mean time you can catch some good posts if you have missed on this blog.
Wordpress Plugin – RSS Post Content
How to create a Wordpress Theme
How to Slice a PSD File
How to fake your Feedburner Subscribers
How to Create a Wordpress Plugin – Hello World!
Posted on March 30, 2009 by Atif
Filed Under Wordpress
If you have a blog like me, you are already fed up of spam and referral comments on your blog. If you own a wordpress powered blog, thankfully with these tips below you can reduce the spam comments to a great extent.
Primarily use the Akismet plugin that you get with wordpress. You need an API key for this plugin to function. Sign up for a free account at Wordpress.org website. You get an API key with your account which you can use on unlimited blog. Akismet filters spam comments very well. There might be some good comments marked as spam as well, happens sometimes but then Akismet plugin learns from mistakes like humans lol. Another alternative would be using the SpamKarma plugin which works the same
But then akismet holding thousands of spam comments doent look good on my blog. I want to avoid spam not just save and mark it. Most of the spam bots hits the wp-comments-post.php file, the file which posts comments. Thus is we disallow all the direct traffic to this file almost 80% of your spam comments are avoided.
Doing this is simple, open up your htaccess file and add this to it.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*mygeekpal.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
This will:
- Detect when a POST is being made
- Check to see if the post is on wp-comments-post.php
- Check if the referrer is in your domain or if no referrer
- Send the spam-bot BACK to you domain homepage.
Posted on March 30, 2009 by Atif
Filed Under Wordpress
Hello readers, you might be excited with this title and yes its true, this post will teach you how to create a wordpress theme. Basically I have created an ebook that wll guide you through the process of creating a wordpress theme from scratch.
The ebook covers all the concepts to create a basic wordpress theme. Rest of the things I will try to cover on my blog. Here is what this ebook covers
Table of contents
Introduction…………………………………………………………………….. 3
Getting Started………………………………………………………………… 4
Initial Steps…………………………………………………………………….. 5
Creating the style.css file…………………………………………………….. 7
Adding theme information……………………………………………………. 7
Adding the index.php file…………………………………………………….. 8
The LOOP Begins…………………………………………………………….. 10
Post Title………………………………………………………………………. 10
Post Date……………………………………………………………………… 10
Author Info……………………………………………………………………. 10
Post Categories………………………………………………………………. 11
The Header……………………………………………………………………. 13
Adding Title / Logo…………………………………………………………… 13
Horizontal Top Menu………………………………………………………… 14
The Sidebar…………………………………………………………………… 15
The Search Form…………………………………………………………….. 16
Pages and Categories Widget……………………………………………… 16
Archives Widget……………………………………………………………… 18
BlogRoll Widget………………………………………………………………. 19
The footer…………………………………………………………………….. 21
The Single.php……………………………………………………………….. 22
Adding Comments Template……………………………………………….. 23
The page.php…………………………………………………………………. 25
Other Resources……………………………………………………………… 26
In case you are stuck anywhere or you want to learn more, hit me an email at atif089 [at] gmail.com or just post a comment here. I will try to help you out.
Click here to download the ebook
Posted on March 29, 2009 by Atif
Filed Under Wordpress
So you want to integrate a Digg This button on your wordpress powered blog huh ? You might have seen most of the bloggers integrate a digg button right in their posts like the one. Digg it if you like it !
Isn’t integrating it beside all the posts as simple as this
<script type="text/javascript">
digg_url = 'WEBSITE_URL';
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
Well if you are using the above code on yout index.php file then forget about it working because it will digg your homepage URL. But what if you want to integrate a digg button of each of your posts right on your homepage ?
Try this..
<pre class=”javascript” name=”code”><script type=”text/javascript”>
digg_url = ”;
</script>
<script src=”http://digg.com/tools/diggthis.js” type=”text/javascript”></script></pre>
I haven’t checked the above code, but I am pretty positive it will work. If it doesn’t work for you then please let me know
Please note that this tutorial required GD Library to be intalled on your web server. Please consult your web host.
I am writing this tutorial just for fun though I dont appreciate these kinds of things. But for those who have relatively low number of subscribers (like I have right now on this , only 4 subscribers) this is a good technique to help you get some subscribers.
Create a new file with any name, In this tutorial I have used feedcounter.php then add the following code to the file and save it.
<?php
//Send a generated image to the browser
create_image();
exit();
function create_image(){
//Create the image resource
$image = imagecreatefromgif('feedcount-static.gif');
//We are making brown color
$brown = ImageColorAllocate($image, 68, 68, 68);
//Check for the get parameters
if (isset($_GET['count']) && is_numeric($_GET['count']))
$feedcount = $_GET['count'];
else
$feedcount = 21;
// Some Alignment Calculations
$bbox = imagettfbbox(7.5, 0,'verdana.ttf', $feedcount);
$xcorr = 0 + $bbox[2]; $xcorr = 36 - $xcorr;
//Add the number in brown color to the image
imagettftext($image,7.5,0,$xcorr,13,$brown,'verdana.ttf',$feedcount);
//Tell the browser what kind of file is come in
header("Content-Type: image/gif");
imagegif($image);
//Free up resources
ImageDestroy($image);}?>
Upload the verdana.ttf font file in the same directory where our php file is. Then open the URL of the php file. use ?count=[number] parameter to put any number of reader. Save the image and use it for your blog.
Incase you dont have GD Library installed on your web server you can use the one I have created. Just change the number and get the image that you want here
FakeBurner – Fake your feedburner counter
Posted on March 29, 2009 by Atif
Filed Under Wordpress
A wordpress plugin can do wonderful things with your blog. Developing a wordpress plugin may look more difficult compared to themes but if you know PHP then thanks to the hooks and functions, developing a wordpress plugin is very simple.
This is a very simple and basic tutorial in which we will create a simple plugin that prints Hello World! on your blog.
Let us begin with creating a new folder inside the wp-content/plugins/ directory. I will name is as hello-world.
Create a new php file inside the folder we just created. I am naming this file as hello-world.php. Now Before we get started with the plugin, let us first add the meta data to the plugin. Open the hello-world.php and add some information on top, something like this
<?php
/*
Plugin Name: Hello World
Plugin URI: http://www.yourdomain.ca
Description: A simple Hello Word Plugin
Version: 1
Author: John Doe
Author URI: http://www.yourdomain.ca
*/
That was our meta data. Meta data is pulled out by the wordpress core and is displayed in the plugins page of your wordpress admin. Now we will create a simple php function to print Hello World! Add this code below to create a simple hello world function
function helloworld() {
echo ("Hello World!");
}
?>
Save the file. The above code will output Hello World! when the function is called from any of your pages. Go to the Manage Plugins page (wp-admin/plugins.php) and activate the Hello World Plugin.
Now we need to call the function from some file to execute it. Open the index.php (or any file like footer.php) file in your current theme folder and add this anywhere where you would like to see the code. (preferably at the end near the footer).
<?php
if(function_exists(’helloworld’)) {
helloworld();
}
?>
Save the file and reload your blogs main page. You mush be seeing Hello World! somewhere where you have put the code. This example might not be interesting but it is a good start to learn coding plugins.
Make sure you are subscribed to feeds, as more tutorials will be coming soon.