Using Slicknav with WordPress

I’ve seen a few people ask about this, but I can’t seem to get any other suggestions to work on my site.. I am trying to use slicknav.js on a WordPress site I’m working on and it is not working at all. I got it to work at one point, but unfortunately had to scrap that site and start over and now I can’t get it working.
I’ve done a little testing and just realized that NONE of my scripts are loading. wp_enqueue_scripts() isn’t passing off any of my scripts at all.. Any idea what I may have done to break that?

I’m developing locally, so I can’t give a link… But here is all my code.

Read More

Functions.php

<?php
// WP Enqueue Styles
function wop_styles() {
    wp_enqueue_style( 'normalize_css' , get_template_directory_uri() .     '/css/normalize.css' );
    wp_enqueue_style( 'fontawesome_css' , 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css' );
    wp_enqueue_style( 'googleFonts_css' , 'https://fonts.googleapis.com/css?family=Montserrat:400,700|Roboto+Slab:400,700|Satisfy' );
    wp_enqueue_style( 'slicknav_css' , 'https://cdnjs.cloudflare.com/ajax/libs/SlickNav/1.0.5.5/slicknav.min.css');
    wp_enqueue_style( 'style_css' , get_template_directory_uri() . '/css/compile.css' );
}
add_action( 'wp_enqueue_scripts' , 'wop_styles' );

// WP Enqueue Scripts
function wop_scripts() {
    wp_enqueue_script( 'slicknav_js' , 'https://cdnjs.cloudflare.com/ajax/libs/SlickNav/1.0.5.5/jquery.slicknav.min.js' , array('jQuery_js', 'slicknav_css') , true);
    wp_enqueue_script( 'theme_js' , get_template_directory_uri() . '/js/theme.js' , array('jQuery_js'), true );
}
add_action( 'wp_enqueue_scripts' , 'wop_scripts' );

my Theme.js file:

(function($){
   $('menu-header-menu').slicknav(); 
})(jQuery);

Finally, here is my HTML markup.

<header class="page-header"> <!--- BEGIN .page-header --->
            <div class="branding">
            </div>
            <nav>
                <?php wp_nav_menu(array('theme_location' => 'header-menu', 'container' => false,)); ?>
            </nav>
        </header> <!--- END .page-header --->

<footer class="page-footer"> <!--- BEGIN .page-footer --->
        <?php wp_footer(); ?>
    </footer> <!--- END .page-footer --->
    </body> <!--- END .page-outer-wrapper -->
</html>

My footer doesn’t show any scripts, and even when I change $in-footer = false, Nothin.

Obviously I have some stuff between the header and footer, but I figured these were the only real important parts..

Any ideas??

Related posts

1 comment

  1. $in_footer
    (boolean) (optional) Normally scripts are placed in the <head> section. If this parameter is true the script is placed at the bottom
    of the <body>. This requires the theme to have the wp_footer() hook in
    the appropriate place. Note that you have to enqueue your script
    before wp_head is run, even if it will be placed in the footer.

    If I understand correctly. You want to call your scripts in your footer but your HTML markup doesn’t include a footer?

    To enqueue scripts in the header ($in-footer=false) it must be before the wp_head() call.

    Reference: http://codex.wordpress.org/Function_Reference/wp_register_script

Comments are closed.