The reason being that:
get_template_directory_uri()
actually returns the parent’s theme url.
To fix it, I simply concatenated the remainder of the path. In this case, the code became:
// loading menu toggle function | located in the child's theme folder
function menu_toggle_enqueue_script() {
wp_enqueue_script( 'menu-toggle', get_template_directory_uri(). '-child' . '/assets/js/menu.js');
}
add_action('wp_enqueue_scripts', 'menu_toggle_enqueue_script');
I figured out the solution on my own and thought I would share it since I did not find this solution anywhere I researched.
Related Posts:
- How to override JavaScript files in child theme?
- Enqueue styles properly in a child theme and stylesheets location
- Is my child theme working properly
- WP .js script file not loading
- wp_add_inline_script not adding when script_loader_tag filtered
- How to enqueue scripts in order of Head section
- Cannot dequeue script in child theme
- javascript not being enqueued correctly
- wp_enqueue wont work on some files?
- Can’t seem to get javascript code working from child theme
- Child theme is not rendering parent and own javascripts (but css loaded properly, js not)
- Enqueuing multiple stylesheets with a child theme
- using a child theme, after enqueing my js file it is loading before jquery
- how to fix loading scripts in child theme?
- How to cache bust a child theme style.css
- Is a text-domain necessary for a child theme
- @package & @subpackage: how to use with child themes
- get_stylesheet_directory() vs get_template_directory() for child theme
- Get parent theme version
- Optimal approach for replacing the 8 header images in a child theme?
- How to transfer changes to a child theme?
- WordPress master + child themes + Git workflow
- something like is_childtheme()
- How could child theme be different than parent theme if I haven’t made changes?
- Child Theme, Functions.php Issues
- Redefining function in child themes
- How to dequeue / deregister parent theme style
- How to disable updates in WordPress theme
- Child theme error “Template is missing”
- Dequeue only stylesheets but not inline style added using wp_add_inline_style
- replace parent theme images in child theme
- Altered media sizes (in dash), not updating to existing images/posts
- How do I make wp_localize_script variables available for child theme?
- HTML head-tag get broken in my child theme
- Localization: Textdomain of Child teme
- How to install bootstrap in child theme
- Prevent a base themes css file from loading
- Including files in Child Themes
- Child Theme vs. Jetpack Editor
- Child them function.php ‘parent-style’: should I name this as parent theme name?
- Remote install won’t find Parent theme when intalling Child Theme, but local install does
- Generate PO File
- configuration for child theme
- Child theme style.css isn’t overwriting parent style.css
- Activate Child Theme .mo and .po files
- Linking to Child Theme PHP Files
- Use child theme on certain pages and not others?
- WordPress Bootstrap Problem
- Child Theme disable customizer defaults
- Override file inside inc in child theme
- Add custom function to child function.php
- Child theme problem
- Undefined functions on the server
- Child Themes of Non-WordPress Sanctioned Templates
- How do WP child-themes work? [closed]
- get_stylesheet_directory() in child theme breaks parent scripts
- Child themes, over riding in the parents theme
- Enqueue custom css file on specific page
- ‘Recent Posts’ links open in new window, without copying the ‘WP_Widget_Recent_Posts’ class
- Best method to add style sheets into child theme?
- What is the correct workflow for modifying child themes?
- wp_enqueue_style referencing parent theme
- styles from child theme not loaded for file other than style.css
- Overide enqueue in non plugable function via child theme
- Child Theme Variables
- Multiple Child Themes
- How to install Bootstrap in a WordPress child theme
- Getting an error. Need to add favicon in my child theme functions.php. What’s wrong?
- Fatal error and use of undefined constant in child theme unless I redefine it
- Trouble translating a Child Theme
- Child Theme over write rules
- Child Theme Customizer not working
- Customize file on inc folder on child theme
- WordPress + Child Theme = Am I missing something?
- How to make a child theme independent of parent?
- Sliding-Doors Child Theme
- WordPress Child Theme – twentyeleven
- Get webpack to work on child theme
- Reenable disabled Elementor widget via child theme
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Copy files from main to child theme (after designing website)
- How to stop customizer settings inheritance from parent to child theme?
- Making a child theme in order to update the parent theme
- change html and css in template files in child theme
- My wordpress site is crash due to excute child theme
- Twenty Seventeen – Navigation bar, logo, header size
- Admin options from parent theme do not bind
- Deregister wordpress script in child theme by js location
- Adding translation files to a child theme
- is it ok to dequeue default parent stylesheet from custom page templates in child theme?
- Why won’t my Custom CSS Load
- child theme performance / avoid import and minify JS files
- Remove HTML from search.php of my parent theme
- css3-mediaqueries-js failing with child theme
- Prevent child theme from inheriting a parent theme’s required file
- Run two concurrent themes in one installation
- About wordpress child themes
- Body classes in child theme
- Edit copyright in Hesita Child Theme
- melville and its child theme