I am trying to set up my very first custom WordPress theme. I am using "front-page.php" to set up a standard landing page, and am trying to use a few jQuery files (all of which are written in compatibility mode). When the functions.php file is written to where I expect it to work, it gives me a 503 error, and the site only works with code I know isn't correct.

I have tried enqueuing vs registering, adding admin code, de-activating and re-registering jquery, and adding all the "add_action"s into one line. What am I missing? No JS of any sort has yet worked on this theme. Here is the functions.php file:

<?php

add_theme_support( 'custom-logo' );
add_theme_support( 'custom-background' );
add_theme_support( 'title-tag' );

function modify_jquery() {
    wp_dequeue_script('jquery');
    wp_deregister_script('jquery');

    wp_register_script('jquery-custom', '//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', false, '1.11.3', 'true');
    wp_enqueue_script('jquery-custom');
}
add_action( 'wp_enqueue_scripts', 'modify_jquery' );

function theme_scripts() {
    wp_enqueue_script( 'navbar', get_template_directory_uri() . '/scripts/navbar.js' );
    wp_enqueue_script( 'fixedheader', get_template_directory_uri() . '/scripts/fixedheader.js', array( 'jquery' ), null, true );
    wp_enqueue_script( 'skills', get_template_directory_uri() . '/scripts/skills.js', array( 'jquery' ), null, true );
}
add_action( 'wp_enqueue_scripts', 'theme_scripts' );

function theme_admin_scripts() {
    wp_enqueue_script( 'navbar', plugin_dir_url( __FILE__ ) . '/scripts/navbar.js' );
    wp_enqueue_script( 'fixedheader', plugin_dir_url( __FILE__ ) . '/scripts/fixedheader.js', array( 'jquery' ), null, true );
    wp_enqueue_script( 'skills', plugin_dir_url( __FILE__ ) . '/scripts/skills.js', array( 'jquery' ), null, true );
}
add_action( 'admin_enqueue_scripts', 'theme_admin_scripts' );

function register_navigation() {
    $args = array(
    'description'   => '',
    'class'         => '',
    'before_widget' => '',
    'after_widget'  => '',
    'before_title'  => '<h3 class="widget-title">',
    'after_title'   => '</h3>' );

  register_navigation($args);
}
add_action( 'widgets_init', 'register_navigation' );

?>

I would like for my site to have a navigation menu that comes down as the reader scrolls down (this worked in a static page before I made it a wordpress theme file), among some other jQuery functionality. The rest of the site works fine, pictures load, etc. but I have not been able to add any script successfully. Any help is greatly appreciated!

0 Answers