WordPress – How to override javascript files in a child theme?

How to override javascript files in a child theme?

Add to your functions.php  file the following code:

<?php
 // hook in late to make sure the parent theme's registration
 // has fired so you can undo it. Otherwise the parent will simply
 // enqueue its script anyway.
 add_action('wp_enqueue_scripts', 'wpse26822_script_fix', 100);
 function wpse26822_script_fix()
 {   wp_dequeue_script('parent_theme_script_handle');
     wp_enqueue_script('child_theme_script_handle',
        get_stylesheet_directory_uri().'/scripts/yourjs.js', array('jquery'));
 }
 ?>

Resource:
http://wordpress.stackexchange.com/questions/26822/how-to-override-javascript-files-in-child-theme


WordPress – Create a Child Theme

How to create a WordPress Child Theme?

Create a new folder:
/wp-content/themes/my-child

Create a new file called style.css in the new folder:

/*
 Theme Name: my-child
 Theme URI: http://the-theme's-homepage
 Description: a-brief-description
 Author: your-name
 Author URI: your-URI
 Template: twentyeleven
 Version: a-number--optional
 .
 General comments/License Statement if any.
 .
 */
 @import url(../twentyeleven/style.css);

Put a screenshot.png file in the new folder.
Override any theme file you want, like index.php, page.php, etc.

Pay attention!
The functions.php file will be added, not overridden!
So, just create a functions.php file with additions and functions you want to override, don’t make a copy of the whole orginal file!

Pay attention!
Don’t forget to switch the theme to the new child theme!

Resources:
http://codex.wordpress.org/Child_Themes
http://www.ostraining.com/blog/wordpress/child-theme/


WordPress – Adding HTML to the header

Add HTML to the header of a WordPress page / post using a plugin

/**
 * Load jQuery + a theme specific javascript file
 */
function kb_load_js()
{
    // A trick to get the child theme directory...
    $child_theme_url = get_stylesheet_uri();
    $child_theme_url = str_replace('/style.css', '', $child_theme_url);
    $output = '<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>';
    $output .= '<script type="text/javascript" src="'.$child_theme_url.'/kb_js.js"></script>';
    echo $output;
}
add_action('wp_head','kb_load_js')

Used in:
Rocket Reader plugin

Resources:
http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head