jQuery in MonsieurPress

What the hell is going on ? No jQuery in MonsieurPress !! Yes, MonsieurPress think it’s heavy. But he is tolerant and he has no problem with jQuery lovers. You can actuality switch back to jQuery with two simple steps :

Enqueue jQuery.

In the function.php file, add the dependency for the main script file by adding it in the array like so :

wp_enqueue_script( 'site-js', get_template_directory_uri() . '/js/scripts.js', array('jquery'), '20160207', true);

Mobile menu jquery way

In the main script, replace the original content with this :

AjQuery(document).ready(function($) {
  $('.js-menu-toggle').on('click', function(){
    $('body').toggleClass('menu-on');
  });
});

And voilĂ  ! You can now do your jQuery things in you WordPress theme the way you want !

Leave a Reply

Your email address will not be published. Required fields are marked *