Quick WordPress Tips – Child theme URL and URI path

A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to change, or add to, the functionality of that parent theme. WordPress Child themes are a great idea to extend the theme a bit without getting your hands dirty with the big deal. For this reason, child themes are the recommended way of making modifications to a theme.
I encountered a problem with my child theme when I wanted to load some of my JavaScript files for the theme’s option which I kept with in the child theme so that the parent theme remains unchanged and all the development is also done in one directory.

When I tried loading the JavaScript using the Template path obtained by

$template_path = get_bloginfo('template_url');

I got the path to the parent theme which of course is wrong in my case as my JS file was in child theme’s folder.

Here is the solution:
Use the URI

Output the URI

With get_stylesheet_directory_uri(), I can load addition JavaScript files in my WordPress child theme

if (is_admin()){ //load scripts for admin page
	wp_enqueue_style('admin-style', get_stylesheet_directory_uri() . '/admin/option.css', false);
	wp_enqueue_script('admin-scripts', get_stylesheet_directory_uri() . '/admin/script.js', array('jquery'), '1.0', false);
	}
}

Share this article if it was of any help, that might help others as well.