Tuesday, 10 September 2013

Wordpress Theme Customization Api - the Way Experts Do!

Follow through the write up and learn the simplest and shortest way to Wordpress Theme Customization by API. It is oddly comforting and easy to use free WordPress themes, especially when they come with all the latest features and functionalities, such as fully responsive and minimalist design etc, but the problem with such free themes is that there isn’t any room for individuality. Your website (and hence you) just appear one of the many others with the same theme layout, and hence even if you are unique, different, superior maybe, the website (and again, hence you) gets sidelined, ignored and even rejected.

After performing a thorough range of PSD to WordPress theme conversion services, we thought it was most opportune for us to discuss about WordPress theme customization and how easily, in a matter of about 10-15 minutes tops one can customize the WordPress theme and give it bespoke appeal.

Start with a Child Theme!

If you are aware of the world of computer programming or software development, you would know that a child class is one which inherits certain or all features and capabilities of the parent class, and WordPress child theme is no different. It inherits the functionalities of the parent themes, while at the same time allowing the developers (yes, since you would be performing the customization today, you get be known as the developer, yayy!,) to easily customize and enhance the functions of the parent theme. Child theme is often deemed as the perfect and the surest and most reliable way to customize a parent theme, irrespective of whether you want to make just small little changes or go for extensive modification.

Hence, the child theme is one which functions and executes itself just like the parent theme, only with a certain level of differentiation, which you specify in the process of WordPress theme customization.

Is child theme really required?

We get it, although using a child theme appears pretty easy to us, but we totally understand and accept it if others don’t feel the same. Well, there is a reason why we are voicing for using the child theme.

Suppose you use the original theme and make certain changes in the theme, perhaps change the way the posts are being displayed, make certain tweaks in the sidebar etc. Then you login to your admin dashboard and there is a new update to the theme waiting to greet you. All excited, you click on the update section and POOF!!

All the time and the effort you dedicated towards customizing the theme previously are now gone, since the update easily overwrote, all of those changes.

However, using a child theme gives you the liberty to update the theme as and when you like and yet keep the changes which you spend so much time making, safe and secure. And you may require new changes when the update comes, but at least you will be much better off than having to start from the scratch.

How to Customize a WordPress Theme with the Child Theme.

If you have finally made up your mind regarding customizing the theme with the child theme, without wasting much time, let us quickly start with the process:

Let us call the original theme – Parent theme, and let us assume it to be residing in /WP-content/themes/ directory. We have used the default and much hyped Twenty Twelve themes of WordPress to create a child theme from. In order to create a child theme, we are required to create a new directory for the child. Let us keep it alongside ‘Twenty Twelve themes’ and assign it a new name – twentytwelve-child.

Wordpress Theme Customization Api : 

Follow through the below mentioned instructions to give a valid name to the child theme in the style.css file:

Child Theme Directory
Theme Name:     Twenty Twelve Child
Theme URI:      http://wp.tutsplus.com/
Description:    Child theme for Twenty Twelve
Author:         Japh
Author URI:     http://wp.tutsplus.com/author/japh
Template:       twentytwelve
Version:        1.0.0
@import url("../twentytwelve/style.css");

Let us consider the two important sections of this process:

1. Template – The ‘twentytwelve’ enables WordPress to know that the theme is actually a child theme of ‘Twenty Twelve’

2. @import url("../twentytwelve/style.css"); – which assumes the responsibility of loading the style.css of the parent theme, which is twentytwelve in our example. Although this line isn’t really a prerequisite in validating the child theme, but you would want to use it both, as a best practice and especially while making small modifications in the theme. 

Now when you login to your WordPress dashboard, you will see a child theme over there; you may want to activate it.

What to do next after getting the child theme?

Now, whenever you need to make any changes or customizations, do that in the child theme instead. Whether you wish to override something in the parent theme, or add a new template, your child will be your laboratory – your playground. 

However, the process has one exception that you need to be aware of. The functions.php file of the child theme is loaded prior to that of the parent theme, hence you need not copy those, and just get started with the child theme on its own.

This way it is ensured that the child theme functionality of their own, and still have the functions of the parent theme. Also, by making the functions of the Parent theme pluggable, the developers (ahem, you!) can easily override them as well.

Understanding Pluggable functions

A pluggable function is one that takes into account whether the function exists previously, prior to defining it. Thus, when a function is defined by the child theme, no conflict is done by the parent theme.

And End note

This was the basis of customizing a WordPress theme. To register a unique presence with the users, consider opting for professional PSD to WordPress theme customization, wherein a beautiful and the enigmatic WordPress theme will be created out of the design file while the team of skilled and professional experts ensure that the website possess robust functionalities and winsome features.

1 comment:

  1. Sound Looks Good! This information really helpful to my website. Thanks fro sharing useful news this post via me. Keep it up!
    joomla video extension