Adding javascript to child theme

You should enqueue the script in child theme’s functions.php. for example if name of the js file is custom.js and if you place it under js folder in your child theme, then in functions.php you should add function my_custom_scripts() { wp_enqueue_script( ‘custom-js’, get_stylesheet_directory_uri() . ‘/js/custom.js’, array( ‘jquery’ ),”,true ); } add_action( ‘wp_enqueue_scripts’, ‘my_custom_scripts’ ); Here … Read more

How to set thumbnail image for a (child) theme

Create image file in PNG Format having name screenshot.png and save it in themes root folder.The recommended image size is 880×660. Even recommended image size is 880×660 though it will only be shown as 387×290 but the double-sized image allows for high-resolution viewing on HiDPI displays. For more information see this page. If you don’t … Read more

Starter Theme vs Parent Theme? Pros and cons

I totally agree with Rarst. I just want to add some small things. Note: I differentiate parent theme and framework. In my answer, I consider parent theme like TwentyEleven where it’s mainly created for a specific website and less hooks than a framework. Starter theme: Pros Easy to customize at HTML level. I mean something … Read more

Childs PHP files not overwriting Parent’s PHP files

Child themes are allowed to override templates, not simply arbitrary PHP files. In WordPress, a theme consists of a bunch of PHP files which are used as Templates. You can find a list of those files in the Template Hierarchy. Those specific template files can be overridden with new ones, but unless the parent theme … Read more

Child themes CSS priority problems without using !important

Try enqueuing your child theme’s CSS like so: // Queue parent style followed by child/customized style add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’, PHP_INT_MAX); function theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ ); wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/styles/child-style.css’, array( ‘parent-style’ ) ); } Notice a few things: 1) PHP_INT_MAX as priority so that this runs last 2) get_stylesheet_directory_uri() vs. … Read more

Override get_template_directory() in child theme?

Late answer, but in WordPress 4.7 two new functions were introduced to address this question. get_theme_file_path() (for absolute file paths) and get_theme_file_uri() (for URLs) work just like get_template_part() in that they will automatically look in the child theme for that file first, then fallback to the parent theme. In your example, you could rewrite it … Read more