Sunday, April 22, 2012

Wordpress :: different files of a theme folder and their uses

Template system is a great feature which is associated with wordpress. Users may have their multiple themes stored inside 'wordpress/wp-content/themes/' folder so that they can select and activate one of them at a time.
Wordpress package comes up with two in-built themes ( twentyten & twentyeleven). Beside these two theme folders if users need more then they may download free themes from websites like simplewpthemes.com, freewpthemes.net etc and upload those themes to this path 'wordpress/wp-content/themes/'. As soon as they will activate one of these folders through admin panel they will get a new look & feel for their website. However users with having bit knowledge in html/css may also build their custom theme. PHP knowledge will be an added advantage in this regard.

Before building their custom theme they should know about the different files of one of the in-built theme folders (twentyten or twentyelven) and their uses. Those files consists of both html and php codes where php codes are responsible for functionalities, html codes are responsible for providing the required format. Below are the list of some files with their uses in wordpress:

header.php : This file contains the content of header section of the web pages. It is included into page.php, index.php etc. Generally the link to css file, javascript file(s) are added in this file. In most cases top menu bar, website logo, home page banner etc are defined in this file.
footer.php : This file contains the content of footer section of the web pages. Generally copy right information and footer links are defined in this file.
sidebar.php : Optionally this file is used when there is a need to display content in either left sidebar or right sidebar of the web pages. Generally left menu or right menu is defined in this file.
index.php : This file is responsible for showing posts which are created by admin through backend. So in wordpress blog is generated though this file.
page.php : This file is responsible for showing the content of pages which are created by admin through backend. It is also a template file as it provides a ceratin look and feel to the pages which are created by admin dynamically.
single.php : This file is responsible for showing individual post on a separate page apart from blog page.
category.php : This page shows all the posts of a particualar category.
404.php : This file shows the error message when a page is not found which is searched by a website visitor. Users can modify the content of this file to show their custom messages to the website visitors.
search.php : This file shows the link of posts and pages as search result when website visitors use different keywords in the searchbox to get their desired result.
comments.php : This file is responsible for showing different comments made by website visitors on different posts along with the comment form which let visitors to post their comments.
archive.php : This file is responsible to show all the posts on the basis of created years and months.

Sunday, April 15, 2012

Wordpress :: build your custom theme

In my previous post I have explained how to install wordpress and it’s basic use. I have given an initial idea about plug-in and template system of wordpress.

Now I am going to explain you how one can build his/her own custom theme and install it through admin panel of wordress provided he/she must have basic knowledge in html/css.  If he/she is completely new to HTML/CSS I would like to him/her to go through this tutorial to have some knowledge on HTML/CSS .

Wordpress theme is nothing but a bunch of PHP files, CSS files, images and optionally javascript files which are bundled together inside a folder. Each php file may consist php code (server side scripting which are responsible for functionalities) along with html code (html is the markup language which is responsible for creating place holder for content, image etc). Similarly each css file consists style definition for html elements like paragraph i.e. p, heading i.e. h1, h2 etc. So all these files & images work together to provide a certain look & feel to the front-end of the website.

By default wordpress comes up with two default themes i.e. ‘twentyten’ & ‘twentyeleven’ respectively. One needs to go through these folders thoroughly before going for creating his/her own custom theme.

Below are some tips which may help you in creating your own custom theme:

  • You must keep your template (html/css) ready which you are going to integrate into your custom theme.
  • Copy one of the default themes for ex. ‘twentyten’ from themes folder of wordpress package (path wordpress/wp-content/themes )  and paste it in some local place of your computer and rename it like ‘mynewtheme’.
  • Replace the css file i.e. style.css within your theme folder ‘mynewtheme’ with the css file of your template and images folder with the images folder of your template respectively. This means now in your theme folder ‘mynewtheme’ you have your css file and images folder as of your new template.
  • You notice there are some files like header.php, footer.php, sidebar.php, index.php, page.php within ‘mynewtheme’ folder and those are the files which are mostly required to build your custom theme. Open all these mentioned files in an html editor like DreamWeaver.
  • Copy the html of header section from the template (which you want to be in header section of your web page) and put it into header.php file. This means replace the code of header.php with the copied code from the template which is meant for header section. Within head tag you will find elements like link, script etc where you need to do some adjustment. Basically link element is used to link to an external style sheet i.e. link rel="stylesheet" type="text/css" href="style.css" /. Here what you have to do is to append a php snippet with the path of css file so that it will point to the absolute path of the css file of the theme. So replace the link rel="stylesheet" type="text/css" href="style.css" / with link rel="stylesheet" type="text/css" href="bloginfo(‘template_url’); /style.css" /. Do the similar changes with the element of script. If your script element is something like script type="text/javascript" src=”example.js”  then change it to script type="text/javascript" src=”bloginfo(‘template_url’); /example.js” . Before the /head add this piece of php snippet i.e. wp_head();  . This is all about tweaking of header.php file. Now save this file.
  • Copy the code of footer section from template and put it into footer.php within theme folder ‘mynewtheme’.
  • Similarly copy the code of sidebar section (if there is any for sidebar of the webpage ) and put it into the footer.php file within new theme folder ‘mynewtheme’.
  • In index.php file you will notice such code snippets like get_header();  , get_footer();  etc. Here get_header() is the function which includes header.php file into index.php file. Similarly get_footer() includes the footer.php and get_sidebar() includes the sidebar.php . You need to place those code snippets as per you need your code for header , footer & sidebar segments should be included to index.php file.

I think this is all about working with your custom theme folder. Now upload the entire folder into the themes folder of wordpress, activate it through admin panel and enjoy the theming.

Wordpress :: the most popular CMS

Wordpress

Those who have absolutely no knowledge in web development and still want to have a website with features like content management and bogging perhaps Wordpress will be the best choice for them. It’s already a built-in package and freely available for downloading from wordpress.org. After downloading the package users need to unzip the downloaded folder and upload the entire files and folders within ‘wordpress’ folder to their server. They have to create a database in their server which will be needed during installation process.

Suppose users have already installed WAMP or XAMP in their system (here I assume WAMP is installed in C: drive) then ‘localhost’ is their root directory. They may upload the entire files & folders which are within ‘wordpress’ to this path c://wamp/www . In this case to view the website users have to type only ‘localhost’ in their web browsers. But if users don’t want to upload files & folders directly into ‘www’ folder instead they want to create another folder for ex. ‘mywordpress’ within ‘www’ they can do so.  In this case to view the website they have to type ‘localhost/mywordpress’ in their web browsers.

As soon as users type the path in their web browsers they will be asked to follow the installation process step by step. In this process they need to enter database name, database user name, database password, database prefix so that all the necessary tables will be created automatically. In the last step they have to enter admin user name, admin password along with other information to complete the installation process. This admin login credential will be used later by website administrator in order to login into admin panel of the website.

There are links in the admin panel to create categories of posts, posts, pages etc. By default the posts which will be created by admin will be displayed on the home page which is known as blogging (so by default home page is the blog page in wordpress). Pages which will be created by admin will be shown in the front end of the website and those pages will be automatically linked from the top menu of the website.

Wordpress has many features including a plug-in architecture and a template system. This means at a time admin panel can accommodate numerous templates (designs) and plug-ins (which are betterly known as Add-ons). Template or theme can provide a certain look & feel to the front-end of the website while plug-in can provide the ability to customize the functionality. By default there only two themes are available in admin panel and admin has to activate one of them. But admin can download free ready-made themes and install them through admin panel to use them as well. Users having little knowledge in HTML/CSS can also build their own customized theme in order install them into wardress.

In my next posts I will explain in detail how to build your own customized themes.

Saturday, April 14, 2012

Does Sachin deserve Bharat Ratna?

Sachin Tendulkar Bharat Ratna
Twenty three years ago when a young kid named Sachin Ramesh Tendulka of 16 years old from Bandra (Mumbai) started playing cricket for the nation, no one could even imagine that one day this young kid would reach such a height of success that other can only dream of. For his indomitable passion for the game not only he has been able to play for so long till now, also during this journey he has bagged many more stupendous personal as well as team achievements. He has been chasing his dream to be the best ever player of the game and he has been successful in this regard. More than 15000 runs both in test & ODIs and highest numbers of centuries in both test and ODIs are more enough to describe his caliber as the ever best batter that the game has produced so far. He added another feather to his illustrious cap recently when he scored 100th ton in his international career.

He has been contributing tremendously into team’s success may it be test series wins on foreign soils or world cup win on home soil in 2011. For his outstanding performances through out these years he has got so many distinct recognitions like his nation’s highest sports award i.e. ‘Rajiv Gandhi Khel Ratna’ , international cricket council’s highest award i.e. ‘ICC player of the Year’ and also highest award given by bible of cricket i.e. ‘Wisden player of the year’ and so on. After winning almost every accolade in the book, there is one recognition that still eludes him - the Bharat Ratna – India’s highest Indian civilian honor.

Here the question arises does Sachin Ramesh Tendulkar really deserve this highest civilian honor of his nation? As this honor is meant for the people who have scarified their life for the upliftment of the society working in field of economy, cultural, educational, scientific etc, is there a serious need to tweak the rules in order to bestow the honor on Sachin? If I am not a hypocrite (I hope I am not) my answer is a big ‘NOOOO’. 

This is why I don’t think Sachin does not deserve this award is:
After all Sachin is a professional entertainer. He has been playing for the country in return of taking money. Every act of Sachin in public life is for money... advertisement etc. Sachin may provide his fan a healthy entertainment, amuse them for sometime, but his contribution to his field of mastery will bring least changes in the real life of the people of his country. But the people who have been working relentlessly in the field of science, medicine, peace, education, economy that a life of common people is related to, in order to bring the changes in the real life of people deserve this highest honor more than Sachin Tendulkar. It will be utmost disrespect to those people who set rule for deserving candidate for this honor if we try to tweak this very rule to pave the way for someone like Sachin. After all Sachin may be the ever best player of the game but he is not bigger than rule, system and country.

Friday, April 13, 2012

Shivnarine Chanderpaul : The unsung hero of Caribbean cricket

I remember many years ago I have read this line from a news paper i.e. "Brian Lara is a moody singer where Shivnarine Chanderpaul is an all time customer". Realizing the feat that Chanderpaul has achieved over the years with his sheer determination , I don't see no wrong saying in that line. In a time when Caribbean cricket is passing through lot of troubles and hazard ness which includes inner fighting between players and board over payment issues, Chanderpaul is playing the role of torchbearer of the game which legacy has been laid by game's great like lord Clive Lloyd, Garry Sobers, Sir Vivian Richards, Malcolm Marshall etc.

Seeing the pathetic ness of Caribbean cricket, many believed that Brian Lara's retirement could bring the end to the existence of cricket in Caribbean island completely, because of the lack interest of the young kid to choose the game as their career. But it's due to Chanderpaul, whose first love has always been to put on the island's cap proudly and who ignored many more lucrative offers to play in foreign leagues, cricket is evolving to restore back it's past glory. Now-a-days I see lot of promising young talents like Kevin Pollard, Bravo cousins, Darren Sammy and many more who can lift the level of the game in this Island, must have inspired by great Chanderpaul in any phase of their life. 

I remember when Chanderpaul started his international career was bit a slow starter. He had many flaws in his techniques because of his chest-on standing position. If I am not wrong his critics were more vocal for his shuffling to offside by exposing the leg stump. But with the passing of time he has been able to develop his game by covering up all those grey areas in his techniques. He has been evolved as a great player in both test and ODI cricket and his outstanding records in these two versions of game are evident of this fact. He has scored around 10000 runs in both test & ODIs with good averages. He is on his path to be among the Hall of Fame cricketers. 

Despite of his superb individual contribution to the game he has been polite and humble throughout his career both on and off the field. He is one of the sportsmen who speaks less and do more with his business. I have hardly seen him engaging himself either in verbal abuse with players of opposite teams or speaking uselessly about anything off the field. He is a kind of guy who wants to shy away from media, glamour and tends to remain focused on his own business. 

Shivnarine Chanderpaul has been a perfect ambassador of the game for his endless love and indomitable spirit for the game. He is a role model for many youngsters of his era who wants to play cricket for the sake of pride and not for the money. To be Sachin Tendulkar one needs to be God gifted (which is easy ) but to be Shivnarine Chanderpaul one must have to strive relentlessly to chase his goal with sheer determination, discipline and diligence.