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');
Cleanup mostly unused calls
function disable_emojicons_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}
function rankya_remove_head_links_from_website() {
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
remove_action( 'template_redirect', 'wp_shortlink_header', 11, 0);
remove_action( 'wp_head', 'wp_generator' );
if( !is_category() && !is_paged() ) {
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
}
remove_action( 'admin_print_styles', 'print_emoji_styles');
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script');
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email');
remove_filter( 'the_content_feed', 'wp_staticize_emoji');
remove_filter( 'comment_text_rss', 'wp_staticize_emoji');
add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );
add_filter('xmlrpc_enabled', '__return_false');
add_filter( 'emoji_svg_url', '__return_false' );
}
add_action('init', 'rankya_remove_head_links_from_website');
Change Avatar for your Brand Image
function rankya_custom_gravatar($avatar_defaults) {
$rankyavatar = 'changeURLForfavicon.png';
$avatar_defaults[esc_url($rankyavatar)] = "Custom Avatar";
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'rankya_custom_gravatar' );
These sample codes can be placed within functions.php for your new WordPress Child Theme