How to Create a Child Theme in WordPress

WordPress Themes Options

WordPress makes it easy for you to quickly create your own custom child themes for customizing your themes to meet your own website needs. In this step by step video tutorial, I show you how to create a child theme using twentyfifteen theme while using the best practices for Theme Development.

Video Tutorial Showing How to Create a Child Theme in WordPress

Sample WordPress Filters and Functions for you to Use in Your New Custom Child Theme

When creating your own custom WordPress child themes, consider using these within your functions.php file:

//allow shortcodes in widgets
add_filter('widget_text', 'do_shortcode'); 

/*remove the default URL field from WP-comments form*/function rankya_disable_comment_url($fields) { 
    return $fields;

/*Let's also add itemprop for < a for post link navigation links as they are important part of WP blogging and Google to follow*/add_filter('next_post_link', 'post_link_attributes');
add_filter('previous_post_link', 'post_link_attributes');
function post_link_attributes($output) {
$searchfor = '<a href='; 
$replacewith = '<a itemprop="url" href=';
    return str_replace($searchfor,$replacewith,$output);

/*USE THIS FOR ITEMPROPs on links in Text Editor. For example, when inserting internal links or external links, you can use itemprop url*/function rankya_tinymce_config( $init ) {
$valid_a = 'a[accesskey|charset|class|contenteditable|contextmenu|coords|dir|download|draggable|dropzone|hidden|href|hreflang|id|lang|media|name|rel|rev|shape|spellcheck|style|tabindex|target|title|translate|type|onclick|onfocus|onblur|itemprop]';
// Add to extended_valid_elements if it alreay exists
if ( isset( $init['extended_valid_elements'] ) ) {
$init['extended_valid_elements'] .= ',' . $valid_a;
} else {
$init['extended_valid_elements'] = $valid_a;
// Pass $init back to WordPress
return $init;
add_filter('tiny_mce_before_init', 'rankya_tinymce_config');

These sample codes can be placed within functions.php for your WordPress Child Theme. I’ve got more complex and useful functions, if you are interested in learning more, simply comment using the form below

72 / 259 Malvern Rd Melbourne Australia 3141

+61421600702 $$

Author: Sagar Bhalerao

Sagar Bhalerao is a digital marketer, MBA, online entrepreneur and SEO specialist (trained personally by RankYa). He is an administrator of RankYa Blog taking care of maintenance while learning more about Search Engine Optimization for creating perfectly optimized websites and blog posts.

Thank you for sharing this blog post. Description: 'How to Create a Child Theme in WordPress is explained, step by step instructions for creating child theme in WordPress. Includes sample PHP codes for you'