Wednesday 14 December 2016

Override Theme Functions with WordPress Child theme

Recently posted about Creating a WordPress Child theme and child theme have Some other important things to we must do in child theme.  Child theme have stable security but understand How to manage and creating a parent theme file, So we are spend much time for developing a child theme and we don’t like lost child theme ability and stable security, If we must understand How to develop a solid child theme.



Override Theme Functions with WordPress Child theme

Creating a child theme, Don’t copy a parent theme files completely to child theme,  Just create a file with same name of parent theme file, Example functions.php parent theme file create in ‘yourtheme-child’ folder, Exact name only work. So copy a parent theme file completely, If you face two problems, broken child theme and Parent theme update not affect in child theme.

Recommended :  How to make WordPress Child theme. #Part One

Making Child themes are easy to a Web designers and Programmers but beginners are little struggle, because editing PHP scripts not a easy thing. Basic Ideas of PHP coding, HTML and CSS is required for developing a child theme.

Add a PHP script to Child theme files

Already mentioned in #Part one to customizing child theme style.css ( CSS stylesheet), Sometimes CSS customization not work, That cause use ‘!important’ tag. You can find latest WordPress coding resourse of Codex child theme.

add_filter( ‘excerpt_length’, ‘my_excerpt_length’ )

Rid of a PHP script to Child theme files

Overriding Parent theme function is hard with comparing Add functions. Rare cause I have faced to Overriding Parent theme functions. Parent theme have pluggable functions and normal. Many ways you can modify Parent theme functions.

Remove filter for editing exiting function

remove_filter( ‘excerpt_length’, ‘twentytwelve_excerpt_length’ );

Completely Remove a feature of parent theme

function remove_parent_theme_features() {
    remove_theme_support( ‘post-thumbnails’ );
}
Mange functions are simple but using Actions and filters more difficult, because hook parent theme functions are easy but we need to get detailed documentation of  parent theme functions, hooks and filters, If Easily we can make awesome child theme. Must care for selecting a popular parent theme for developing a child theme, I recommend to use default  WordPress Theme if we can use official WordPress forums for Have any doubts.

I’m using ‘Twenty Twelve’ Child theme , Why I selected ‘Twenty Twelve’? It have many various sources for referring child theme development and Twenty twelve layout is fit to make child theme to BloggingSector, After I’ve started to make child theme.  Find right Parent theme for your blog and make child theme, If your work will be reduce.

No comments:

Post a Comment