javascript - unable to add custom js script in child theme -
i need add custom script in child theme in wordpress.
this content of child theme :
themes |meteorite |style.css |meteorite-child |function.php |style.css |js |mngclk.js
my function.php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css'); } wp_register_script( 'new-script', get_stylesheet_directory_uri() . '/js/mngclk.js', 'jquery', "1", true); wp_enqueue_script( 'new-script' );
i tried multiple change did not manage inclute custom js script
this proper example
function my_theme_enqueue_styles() { $parent_style = 'parent-style'; // 'twentyfifteen-style' twenty fifteen theme. wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ), wp_get_theme()->get('version') ); } add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
follow link more info
Comments
Post a Comment