Category Archives: Wordpress & Blogs

What is a WordPress Child theme & how to customize WordPress Theme using WordPress Child theme?

wordpress-child-theme-customize

We all know that a WordPress theme is a collection of template files which lets us change the user interface, design, look & feel of the site.

 

Have you created WordPress theme or have installed any free theme or commercial one, many of you have done this job and have also customized but the problem is created when you have customized the original theme files and the update of that theme is available and you never would like to update as your customization will get destroyed if you update that, but my recommendation is that you should always keep your plugins and themes updated to the latest version. So you should take care during the customization and never do the customization in original file and should create a child theme. But what does that mean, and how do you do it?

 

In WordPress 3. 0 or latest versions a new concept was added by WordPress core team and community named as “Child Theme”.

 

As per the WordPress Codex definition of Child Theme:

 

“A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme. 

Child theme allows you to modify, or add to the functionality of that parent theme. A child theme is the safest and easiest way to modify an existing theme, whether you want to make a few tiny changes or extensive changes. Instead of modifying the theme files directly, you can create a child theme and override within. “

 

How to work with WordPress Child Theme?

 

Let’s take an example; I’ll create a child theme for WordPress default ‘Twenty Twelve’ theme.

1) So in this case, to create a child theme, I have to create a new directory alongside the ‘Twenty Twelve’ theme’s directory called twentytwelve-child.
“twentytwelve-child” directory should be in parallel of original theme twentytwelve.

2) Create a style.css file under the ‘twentytwelve-child’ theme directory.

Put the below text in style.css file

/*
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
*/

// This @import line loads the stylesheet of parent theme
@import url('. . /twentytwelve/style.css');

//Theme customization starts here

There are two important parts here to notice:

Template: twentytwelve
It tells WordPress that this theme is a child theme of the ‘Twenty Twelve’ theme

@import url(“. . /twentytwelve/style.css”);
It loads the parent theme’s (twentytwelve in this case) style.css as a starting point

3) Now you can log into your WordPress dashboard and see your ‘Twenty Twelve Child’ theme there, and activate it.

4) Make further alterations & addition and you will found that these will automatically reflected on your website.

 

Just Done!!

 

Now always keep in mind that whenever you want to make a customization to your theme, does it in your child theme.

Files in your child theme override files of the same name in the parent theme. So any file from your parent theme you want to change, copy to your child theme & make your modifications there.

The same goes for any templates that may not be in your parent theme. You can add them in your child theme, and WordPress will use them.

One exception to these rules is the functions.php file. In this case, the functions.php file for the child theme is loaded first, followed by the functions.php file of the parent theme. So there’s no need to copy the functions.php file from the parent into the child, just start fresh in the child theme for that one.

This allows the child theme to have all the functionality from the parent theme. Parent themes can also make their function pluggable, which allows a child theme to override them.

 

Why should you use WordPress Child Themes?

 

1. Safe Updates

A child theme automatically inherits the parent theme’s features, styles, and templates. This allows you to make changes to your site using child themes without ever modifying the parent theme. When a new version of the parent theme available, you can safely update it as you know that all your modifications are saved in the child theme.

 

2. Easy to Extend
A child theme built on a powerful theme framework allows a great deal of flexibility without writing a lot of code. You can selectively modify only the template files and functions that you need without going through other template files. You can add new functionality and much more.

 

3. Fall-back Safe
When you are creating a complete theme you need to think about all the possible scenarios and code for them. However, when you are working on a child theme and you forget to code for something, then there is always the parent theme’s functionality available as the fallback option.

 

WordPress catchable Tools for Child Theme

 

One-Click Child Theme plugin built and tested for the latest WordPress 3.x version.It adds a menu link into your Admin “Themes” section to automatically build a child using your currently active theme.This is fantastic if you don’t want to mess with FTP and are looking to play around with some new ideas.You can also use Child Themify plugin for creating the child themes.

 

If you plan to edit these files within the admin panel you’ll also enjoy clearer syntax highlighting for that you can install the Advanced Code Editor for some much-improved functionality. This makes wading through PHP code blocks and HTML/CSS a whole lot more manageable.

 

Additional Resources & references

 

1. http://wp.tutsplus.com/tutorials/theme-development/child-themes-basics-and-creating-child-themes-in-wordpress/

2. http://www.hongkiat.com/blog/wordpress-child-themes-dev/

 

Hope this all helps.

 

How to Import Large XML File (WXR file) in WordPress

import-wordpress-xml-wxr

You all knows that WordPress comes with built in import/export functionality that allows you to import or export your WordPress posts in XML format.

 

Have you ever tried to move your blog from one server to another, I think you have done this many time. But I am pretty sure that you were stuck in case the WXR (XML) file is very large to import? I have also faced this one but after a little search on Google, I have found perfect solution & sharing the same with you, hope this will help you to save several minutes.

 

I am also sure that you have tried to fiddling with PHP variables to increase the upload size limit, but even then you might run into some sort of execution time-out. But in case of large file, your server admin may not even let you change these settings or will show timeout even after updating.

 

The perfect way is to split your huge WXR data file into smaller chunks.

 

Even though you can manually split your large XML files by creating multiple XML files with the same header, category, and footer information and dividing the rest of the items. But no one has time for that and obliviously it increases chances of mistakes? There is a very nice free tool that allows you to split your XML files with just a few clicks.

 

Version 1.52 of the WXR Splitter is here!
Download the below and split your large file in chunks automatically.

 

WordPress XML (WXR) splitter

 

WXR splitter comes with the features
1)  Super fast parsing of the WXR file.
2)  Files are split by file size rather than by number of lines or tags.

 

Minimum requirements for running the WXR splitter

Operating System: Windows XP, Windows Vista, or Windows 7 with the .NET 2.0 framework installed.
(If you don’t have it installed, you can download .NET 2.0 directly from Microsoft)

 

There is a similar WordPress WXR Split utility available for Mac users. Use the below link to download

 

Click here to Download

 

Still trouble with the tools? Or need more help, post your comment below.

Disable All WordPress Updates Notifications

disable-wordpress-updates-all-at-once

First of all, there is no benefit of disabling plugin updates.

 

It is very important as I have previously said in the posts that you should keep your WordPress version as well as plugins up to date. If you don’t keep, then your site could be susceptible to security vulnerabilities or performance issues.

 

But as we are developers like this ability because we do not want the clients to upgrade a plugin himself (If it may breaks the site :-)) although this is not a good reason.
We are potentially risking security, performance, and additional features all because of a fear that the site will break down due to an upgrade, it’s bad it’s it?

 

Another reason that developers disable plugin updates is if they have customized the core files. You can also use a plugin like WP Manage plugins which allows you to disable plugin updates for specific plugins.

 

But if you want to hide all the updates related notifications, just all the below codes in your theme’s “functions.php” file.

 

<?php

//Disable WordPress Theme Updates 3.0+
remove_action( ‘load-update-core.php’, ‘wp_update_themes’ );
add_filter( ‘pre_site_transient_update_themes’, create_function( ‘$a’, “return null;” ) );
//Un-schedule all previously-scheduled cron jobs for WordPress themes versions/updates check
wp_clear_scheduled_hook( ‘wp_update_themes’ );

 

//Disable WordPress Plugin Updates 3.0+
remove_action( ‘load-update-core.php’, ‘wp_update_plugins’ );
add_filter( ‘pre_site_transient_update_plugins’, create_function( ‘$a’, “return null;” ) );
//Un-schedule all previously-scheduled cron jobs for WordPress plugin versions/updates check
wp_clear_scheduled_hook( ‘wp_update_plugins’ );

 

//Diasable WordPress Core Updates 3.0+
add_filter( ‘pre_site_transient_update_core’, create_function( ‘$a’, “return null;” ) );
//Un-schedule all previously-scheduled cron jobs for wordpress versions/updates check
wp_clear_scheduled_hook( ‘wp_version_check’ );

?>

Remove WordPress version number from the head section and RSS feeds & also from version parameter in JS and CSS files

remove-wordpress-version-numbers

Remove WordPress version number from the head section and RSS feeds & also from version parameter in JS and CSS files

 

By default WordPress adds a Meta tag in the headers which displays the current using WordPress version number.

This version number is added just for tracking the site on WordPress, it is not required by your application, but this information can be very much useful to hacker to identify which version of WordPress you are using.

If you are not using latest WordPress version, the hackers can target the known vulnerabilities in that version to hack your site.
You can check all the Vulnerability in “Open Sourced Vulnerability Database” founded at http://osvdb.org/

 

There are various ways that can be used to remove this information below is the best one.

 

Add these following codes to in your functions.php file of your theme according to your requirements.

<?php

/* Function to hide WordPress version number
*  from the head section and RSS feeds on your site.
*/

function my_remove_version_info() {
return ”;
}
add_filter(‘the_generator’, ‘my_remove_version_info’);
?>

 

Remove the “ver” parameter from all enqueued CSS and JS files in the page

<?php

/* remove wp version param from any enqueued scripts (css/js)*/
function vc_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, ‘ver=’ ) )
$src = remove_query_arg( ‘ver’, $src );
return $src;
}
add_filter( ‘style_loader_src’, ‘vc_remove_wp_ver_css_js’, 9999 );
add_filter( ‘script_loader_src’, ‘vc_remove_wp_ver_css_js’, 9999 );
?>

 

Remove only the “ver” parameters which have WordPress version number from all enqueued CSS and JS files in your page.

<?php

/* remove wp version param from any enqueued scripts (css/js)*/
function vc_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, ‘ver=’ . get_bloginfo( ‘version’ ) ) )
$src = remove_query_arg( ‘ver’, $src );
return $src;
}
add_filter( ‘style_loader_src’, ‘vc_remove_wp_ver_css_js’, 9999 );
add_filter( ‘script_loader_src’, ‘vc_remove_wp_ver_css_js’, 9999 );
?>

 

It is always recommended that you have the most updated version of WordPress.

 

How to move your wordpress site to a new domain – easy wordpress migration

wordpress-easy-migration

WordPress stores the URL in his database, one of my colleague is new bie for WordPress.He has developed a new WordPress site and client has given all the data to him.After making the full site ready, he get stuck that four most important tables have URL in it, so should all the data need to re-enter by WordPress admin.

 

I know most of the WordPress newbie think like this, but it can be done by below eight very simple queries (in the case if you have not installed any large plugins)

 

What you need to done is just replace
@old-wp-url@ and @new-wp-url@ as per your website and run these query.

 

UPDATE wp_options SET option_value = REPLACE (option_value, “@old-wp-url@”, “@new-wp-url@”) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

 

UPDATE wp_posts SET guid = REPLACE (guid, “@old-wp-url@”, “@new-wp-url@”);

 

UPDATE wp_posts SET post_content = REPLACE (post_content, “@old-wp-url@”, “@new-wp-url@”);

 

UPDATE wp_posts SET post_content = REPLACE (post_content, CONCAT(‘src=”‘, “@old-wp-url@”), CONCAT(‘src=”‘, “@new-wp-url@”));

 

UPDATE wp_posts SET guid = REPLACE (guid, “@old-wp-url@”, “@new-wp-url@”) WHERE post_type = ‘attachment’;

 

UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, “@old-wp-url@”, “@new-wp-url@”);

 

UPDATE wp_links SET link_url= REPLACE (link_url, “@old-wp-url@”, “@new-wp-url@”);

 

UPDATE wp_links SET link_image = REPLACE (link_image, “@old-wp-url@”, “@new-wp-url@”);

 

Now move your WordPress site to a new domain is very simple, isn’t it!!

If you still face any issue, post your comments.

Some Essentials WordPress Plugin every WordPress site owner should install

essentials-wordpress-plugin-every-wordpress-install

Some Essentials WordPress Plugin every WordPress site owner should install.

 

Better optimized theme

You should choose the theme as per your website is made for. If your website is a shopping cart then it should be attractive.
If it is just for blogging then it should be very simple and easy to load, so whenever the website owner starts with WordPress, he should choose the theme very carefully and according to your website needs.

 

There are many WordPress theme available for Free and Paid.

http://wordpress.org/extend/themes/

 

301 Redirect

In WordPress permalinks, for make your site better in search engine you have to select the proper permalinks for URL.
Suppose you have selected a structure (permalink) for URL, and after sometime you found it not appropriate for your site and SEO.
Or you have found that the POST or PAGE title is not as good for SEO and therefore you need to update that, then it will create a problem for Search Engine Webmaster Tools.

 

The problem is that the URL (old one) is already crawled by Search engines and it will take time to crawl the website again by the search engine.
During this period, if users come to your site using search engine and click on that URL then it will redirect the user to 404 page of your website.
I think no webmaster like this.

 

So for that we have a solution called as 301 redirect(permanent) redirect of the old url to new url, we can do the same using .htaccess Tricks.
For making or easing the same we have a very simple plugin called as 301 redirect, according to me every website owner who use WordPress should install this, this will automatically do this job for you.
http://wordpress.org/extend/plugins/wp-seo-redirect-301/

 

WordPress SEO plugin by Yoast

SEO is a very vast field in web technology, the main concern of SEO is to make the site optimized and popular so that search engines will prioritize your website URL to display it first.

 

Yoast always proved his superiority in SEO, and they have developed a very good and nice SEO plugin for WordPress, it helps the website owner a lot to optimize and increase the traffic on the site.
http://wordpress.org/extend/plugins/wordpress-seo/

 

W3 Total Cache

If your website have a lot of images or content and js and css files, then it will slow down your website to load on browser, i.e. your page speed will slow down. There are lot of technique that can be used as the js and css minified. Cache the content and images, so that it will help the browser to load the page speedily.

The ‘W3 Total Cache’ plugin will help you to speed up the pages loading time.
http://wordpress.org/extend/plugins/w3-total-cache/

 

Captcha and Contact Form 7

As if your website will popular and people will want to contact with you, for that you need some type of form for contacting?
Contact Form 7 is very easy to use and customizable according to your theme.
http://wordpress.org/extend/plugins/contact-form-7/

 

Share Buttons for Twitter, Facebook, Google+ & more

In today’s world we know how much people and how many times they use social networking website, so to make your website popular, you should add social networking links. That can be used by the user to share the articles. It will help to make your website popular as almost all the guys use internet have some social website account.

 

If you like this article, I have also given the links for sharing this, so click on those to share this with your friends.
Below WordPress plugin is there to fulfilling the same job in very easy manner.
http://wordpress.org/extend/plugins/hupso-share-buttons-for-twitter-facebook-google/

 

Facebook fan Page

Facebook fan page increase your website subscribers.
and your website popularity and traffic will increase rapidly.

You can use the below WordPress plugin for the same, it will prove very helpful.
http://wordpress.org/extend/plugins/skysa-facebook-fan-page-app/

 

 

Google Custom Search

Google custom search improve the search functionality in your website as you all know how powerful Google is.
So if you add Google custom search in your website then it will handle the search functionality of your site very easily and very fast i.e. the result will display very fast.

 

It fetches the result from its database i.e. it show the related indexed pages from Google database of your website.
However it is very easy to integrate, but it is more simpler by using the WordPress plugin , if you are using WordPress.
Use the below WordPress plugin, to add Google custom search in your website.
http://wordpress.org/extend/plugins/google-custom-search/

 

 

WP-DBManager

A dynamic website is totally depends on its database. Optimized databases always help in speeding up the page load time and optimize the site.
The Database of your website should be safe, so for that you should take backup of your database at a regular interval, so if your website faced some malicious threat attach then you can recover by the backups files and database.

The below WP-DBManager WordPress plugin have almost all the functionality related to the database.
According to me every webmaster should install this plugin to optimize the database and backups.
http://wordpress.org/extend/plugins/wp-dbmanager/

 

 

Feedburner Email Subscription

Email subscription is the way by which the user can register for your website and will get all the update related to new post added, update or deleted.

Google Feedburner Tool helps a lot in this and provides a very good functionality related to this.
For implement this Google Feedburner helps and guides to integrate this in your website.
If you are using WordPress then you can use the Feedburner Email Subscription plugin and can enjoy the great functionality it have.
I have also integrated this in my website, If you want to subscribe for my website updates Go to left sidebar and enter your email in the box and submit.
http://wordpress.org/extend/plugins/feedburner-email-subscription/

 

 

Better WP Security

WordPress Open source CMS is used by very large number of users, so the way of coding in WordPress and functions URL can be easily known to the hackers.
So you should aware, if you are using WordPress in your website.
Like wordpress admin access URL is usually wp-admin.

 

Mostly the admin user id is 1 and username is admin, username can also be known easily using the login form submission using wrong password.
Generally the table prefix is wp_.
.htacces, wp-config (file where the main site configurations present) read/write permission and so on.

 

To protect your website from these all, you should install Better WP Security plugin in your WordPress site admin.
Please take care before installation as it takes effect and update core and server configuration files.
So take backups of files and database before installation and activation of plugin.
If have just installed WordPress then you can install and make active without any head-ache but if your website is in running stage and you have lot of content then you should take care in each and every step of activation, every single step can make your website in unstable state, so be careful.
http://wordpress.org/extend/plugins/better-wp-security/

 

 

These WordPress plugins are essentials, i.e. every master should install these in his website.

 

These will help to make popular your website, increase the web traffic and optimize your website.
Let me know if you face any issue related to above WordPress Plugin.