• Resolved JudahsMom63

    (@judahsmom63)


    I’m building a job application form on one page. WordPress reads the HTML just fine, but it doesn’t recognize my .css and .js files. I’m putting my code in my child theme functions.php file. The code looks like this:

    PART THAT WAS ALREADY THERE:

    <?php
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css' );
        }
    endif;
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css' );
    
    // END ENQUEUE PARENT ACTION

    NOW THE PART I ADDED:

    /*
    Javascript form registration and enqueue follows
    */	
    
    	function my_coding() {
    
    		wp_enqueue_script( 'appForm', get_stylesheet_directory_uri() . 'js/appForm.js', array( 'jquery' ) );
    
    		wp_enqueue_script( 'validate', get_stylesheet_directory_uri() . 'js/jquery.validate.min.js', array( 'jquery' ) );
    
    		wp_enqueue_style( 'appForm_css', get_stylesheet_directory_uri() . 'css/appForm.css', array( 'jquery' ) );
    
    		wp_enqueue_style( 'appProcess', get_stylesheet_directory_uri() . 'css/appProcess.css', array( 'jquery' ) );
    
    		wp_enqueue_style( 'css_theme', get_stylesheet_directory_uri() . 'css/jquery-ui.theme.css', array( 'jquery' ) );
    
    		wp_enqueue_style( 'css_structure', get_stylesheet_directory_uri() . 'css/jquery-ui.structure.css', array( 'jquery' ) );
    
                   wp_enqueue_script('jquery-ui-accordion ', array('jquery') );
    
                   wp_enqueue_script('jquery-ui-datepicker ', array('jquery') );
    
                   wp_enqueue_script('jquery-ui-tabs ', array('jquery') );
    
    	}
    
    	add_action( 'wp_enqueue_scripts', 'my_coding' );
    
    /*
    Javascript form ends
    */

    I tried registering my code before enqueueing it, but that made no difference. Please, can someone tell me what I’m missing and/or what I’m doing wrong? Please??? Desperation is setting in!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter JudahsMom63

    (@judahsmom63)

    I tried this code but it didn’t help. As a frustrated code-writing newbie I would appreciate any help I can get!

    /*
    Javascript form registration and enqueue follows
    */	
    
    	function my_coding() {
    
    		wp_register_script( '', get_stylesheet_directory_uri() . 'js/js', array( 'jquery' ) );
    		wp_enqueue_script( 'appForm', get_stylesheet_directory_uri() . 'js/appForm.js', array( 'jquery' ) );
    
    		wp_register_script( 'validate', get_stylesheet_directory_uri() . 'js/jquery.validate.min.js', array( 'jquery' ) );
    		wp_enqueue_script( 'validate', get_stylesheet_directory_uri() . 'js/jquery.validate.min.js', array( 'jquery' ) );
    
    		wp_register_style( 'appform_css', get_stylesheet_directory_uri() . 'css/appform.css', array( 'jquery' ) );
    		wp_enqueue_style( 'appForm_css', get_stylesheet_directory_uri() . 'css/appForm.css', array( 'jquery' ) );
    
    		wp_register_style( 'appProcess', get_stylesheet_directory_uri() . 'css/appProcess.css', array( 'jquery' ) );
    		wp_enqueue_style( 'appProcess', get_stylesheet_directory_uri() . 'css/appProcess.css', array( 'jquery' ) );
    
    		wp_register_style( 'css_theme', get_stylesheet_directory_uri() . 'css/jquery-ui.theme.css', array( 'jquery' ) );
    		wp_enqueue_style( 'css_theme', get_stylesheet_directory_uri() . 'css/jquery-ui.theme.css', array( 'jquery' ) );
    
    		wp_register_style( 'css_structure', get_stylesheet_directory_uri() . 'css/jquery-ui.structure.css', array( 'jquery' ) );
    		wp_enqueue_style( 'css_structure', get_stylesheet_directory_uri() . 'css/jquery-ui.structure.css', array( 'jquery' ) );
    
                   wp_enqueue_script('jquery-ui-accordion ', array('jquery') );
    
                   wp_enqueue_script('jquery-ui-datepicker ', array('jquery') );
    
                   wp_enqueue_script('jquery-ui-tabs ', array('jquery') );
    
    	}
    
    	add_action( 'wp_enqueue_scripts', 'my_coding' );
    
    /*
    Javascript form ends
    */
    Thread Starter JudahsMom63

    (@judahsmom63)

    Nevermind. I figured it out.

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

The topic ‘using wp_enqueue’ is closed to new replies.