• jishasanal

    (@jishasanal)


    Hi all,

    I was using hueman theme.and I have created a child theme by using childify me
    plugin.I named it as childhueman.Childhueman folder already has functions.php and style.css file.
    I have created a custom Jquery file named jquery.js in childhueman folder.
    childhueman/functions.php contains the following code

    function theme_js() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );
    wp_enqueue_script( ‘theme_js’, get_stylesheet_directory_uri() . ‘/custom_js/jquery.js’, array( ‘jquery’ ), ‘1.0’ );
    }
    add_action(‘wp_enqueue_scripts’, ‘theme_js’);

    When I load
    http://www.easybuddy.com.au/awpcp/browse-categories/?
    all images are comes and goes immedialty.

    Anybody please help me?

Viewing 4 replies - 1 through 4 (of 4 total)
  • jack randall

    (@theotherlebowski)

    http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/ take a peek at this. you may need to register the scripts before you enqueue them and add the action, it’s been a while since i did it!

    Thread Starter jishasanal

    (@jishasanal)

    Hi jack randall,
    I have register the scripts but I got the same result nothing change…

    function theme_js() {
    wp_register_script(‘custom_script’,get_stylesheet_directory_uri() . ‘/custom_js/jquery.js’,array(‘jquery’),’1.0′ );
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ ); // enqueue the script
    wp_enqueue_script(‘custom_script’);

    }
    add_action(‘wp_enqueue_scripts’, ‘theme_js’);

    Clarion Technologies

    (@clarionwpdeveloper)

    Hello jishasanal,

    Please try using below code

    function theme_js() {
    wp_register_script('custom_script',get_stylesheet_directory_uri() . '/custom_js/jquery.js',array('jquery'),'1.0' );
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); // enqueue the script
    wp_enqueue_script('custom_script');
    
    }
    add_action('wp_head', 'theme_js');

    Thanks

    Thread Starter jishasanal

    (@jishasanal)

    @clarion Technologies ,
    thank you for hepling me..
    I have changed wp_enqueue_script to wp_head but nothing happened.
    this is my style.css in childhueman folder
    /*
    Theme Name: Childhueman
    Version: 1.0
    Description: A child theme of Hueman
    Template: hueman
    Author: jisha
    */
    /* Your awesome customization starts here */
    @import url(“../hueman/style.css”);
    @import url(“../hueman/responsive.css”);
    @import url(“../hueman/assets/front/css/main.css”);

    Do I need to delete this import?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How to wp_enqueue_script in child theme's functions.php?’ is closed to new replies.