Posted on November 8, 2008 with No Comments
This is the third post in my ‘WordPress theme for uber n00bs‘ series. If you haven’t read my past posts in the series you will not understand what I am talking here, so go and try to learn the previous posts in the series.
This part is where you exactly need a locally installed WordPress, From this chapter we are going to create a WordPress theme step by step, So Install the WordPress in your computer for convenience. If you have installed Web Developer Server Suit, The server must be running now, go to http://localhost/wordpress/ to start running WordPress, you might need to finish the WordPress installation (Giving email, Blog name and getting a password.)
Step 1: make sure your local host is running, Open the ‘Web-Developer Controller’ from your Windows Desktop, we need Apache and MySQL running to start and work on WordPress (See the marking, in below picture)

Now the local server must be running on your PC, you can close the ‘Web Developer Suit Controller’ window now, and Navigate to the WordPress theme folder in your local disk : %drive%\www\webapps\wordpress\wp-content\themes\ – replace the %drive% with your Drive letter, C:\, D:\ etc.. where Web Developer Suit is installed.
Step 2 : Now create a folder for your theme in the WordPress themes folder, name it as tutorial for now.
Step 3 : Now open intype or notepad and create blank style.css and index.php files in the folder tutorial. Now open index.php in intype and paste these lines to it and save it.

<?php get_header(); ?>
<?php include(TEMPLATEPATH . '/blog.php'); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Now you did is, you called the header, blog-module, sidebar, and footer templates to the index.php , these are the modules we are going to create in the coming episodes. Now your tutorial theme folder must be like this

For some more expansion we can add theme information. Theme informations are added in the first lines of style.css file as some comments. WordPress can read the theme details from it.
/*
Theme Name: FeatherPot Tutorial
Theme URI: the-theme's-homepage
Description: A basic theme created with the help of a FeatherPot Tutorial
Author: FeatherPot Reader
Author URI: http://featherpot.com
Version: 1.0
.
General comments/License Statement if any.
To create your own WordPress theme follow the tutorial in FeatherPot. This is a Free theme released under GPL terms
.
*/
Now you can activate the theme we are creating, login to the the WordPress dashboard of local installation by http://localhost/wordpress/wp-admin/, and navigate to Design > Themes > and activate the ‘FeatherPot Tutorial‘ theme by clicking on the name. you can see the theme details we have just added into the style.css working here. Take a look at the theme we just made, how is that ?
OK, don’t get nervous, you are seeing some errors because WordPress can’t find some template files we said to include to the index.php only you and me know that we didn’t created those templates, and we will create them in the coming episodes.
Hope you have understood todays class, keep in mind that a WordPress theme must have a style.css and index.php to work, else you will not be able to find the theme in the Design selection area of WordPress dash board. That means a WordPress theme will not work if there are many files except index.php and style.css
Stay tuned without destroying the work we have done. If you have any doubts kindly add it as a comment, emails / IMs won’t get a reply anymore !
Tags: CSS, downoad, Free, Freebie, HTML, php, programming, Template, theme, tut, Tutorial, wordpress
Category: Tutorials
Posted on August 9, 2008 with 3 Comments
I don’t use affiliate link directly behind some text, but i used to keep them hidden behind a page in my website, I use a single php file to handle all my affiliate link and let users to navigate into them with a different url structure that looks similar to a page of my blog.
There are many ways to hide affiliate urls, Some peoples apply them directly, Some others use URL shrinkers such as TinyUrl etc.. And someothers use it intelligently in some other ways. I will show you some of them.
One file per link
Some people uses this technique to redirect users to their affiliate link, They use JavaScript, php header / meta refresh etc.. to make this. One of the problem with this trick is, it will make separate files for each link that you want to cloak, this will generate tons of files after some time.
One file for many links
After all miscellaneous stuffs, now we are on the actual area of what this article is about. Redirect to bunch of affiliate links with just one php page ! I am sure this can be done on any servers that running php and Apache.
Anyway the first thing we need to create is a php file to bind all our affiliate links. Take a look at the example template given below.
<?php
// Filename: link.php
// Coded by: Ben Jacob
// E-mail: ben@featherpot.com
// More: http://featherpot.com
/*
http://yourdomain.com/redirect.php?site=company
This example has the same meaning for the other entries in $links variable.
*/
$links = array(
# Product links
"wordpresstheme" => "https://www.e-junkie.com/ecom/gb.php?ib&aff=321654&ev",
"blogmastermind" => "http://www.blogmastermind.com/affiliates.php?af=1234567",
# Affiliate Links
"oiopublisher" => "http://www.oiopublisher.com/ref.php?u=000",
"textlinkads" => "http://www.text-link-ads.com/?ref=123456",
# Simple sites
"google" => "http://www.google.com",
"twitter" => "http://www.twitter.com",
"myflickr" => "http://www.flickr.com/benjacob/",
);
# redirection
header("Location:".$links[$_GET['site']]);
exit;
?>
None of the above Affiliate url are real
Don’t understand anything from the above codes ? Don’t worry its simple.. I will explain. All things thats begins with # or // are just comments, ignore them Its beging used for the future. If you comment the codes its easy to modify them in the future without any confusion about the specific snippet.
$links = array (); We are starting a new array of links from this line in the code. each line URLs that placed in separate line will be considered as a new link.
"google" => "http://www.google.com",
Here the url: http://google.com can be redirected by a single keyword word ‘google’. To add more links to the list you can copy the above template and replace the keyword and url.
The last line is the same header redirect that has been used in the other examples, but instead of hard coding the link in there, it chooses the appropriate definition based on what keyword was passed in the URL.
Now how will you use this file to redirect links by passing keywords ? Ok, for that consider http://example.com/go/links.php as this file on your server. Just linking to that file will do nothing because you didn’t tell it which keyword to use. If you want it to work, you link to “example.com/go/link.php?title=google”. The file will get “google” as the link variable, look up the redirect link, and perform the correct redirect. The link will navigate you to http://google.com that we have defined in the php file.
Demo
http://featherpot.com/go/link.php?site=google => http://google.com
But that doesn’t look much better than the normal affiliate links you are trying to hide, does it? Well, there is a way to make them look however you want. Stay tuned ..!!