Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
How to include smoothState.js or any JS library in wordpress theme efficiently

me and a friend web developer tried so many solutions before bothering you here. We humbly ask your help, We also saw that Stack overflow is open for help if we put the tag : smoothState.js. we really need your help, here's our problem :

We tried to include the JS library (or jquery plugin i should say ) in my wordpress theme https://github.com/miguel-perez/smoothState.js#intro

and we followed this article instructions to achieve that : https://webdesign.tutsplus.com/tutorials/how-to-integrate-smoothstatejs-into-a-wordpress-theme--cms-26610

So the steps we followed are : 1- create a child theme 2- copy and paste the jquery.smoothState.js from github repository to main theme --- asset --- js [1]: https://i.stack.imgur.com/CfMGS.jpg here's the screenshot : [enter image description here][1]

3- use the wordpress function to enqueue javascript in function.php of the child theme : The code is like that :

wp_register_script( 'scount', get_template_directory_uri() . '/assets/js/jquery.smoothstate.js' );
wp_enqueue_script( 'jquery-smoothstate-js', 'assets/js/jquery.smoothstate.js', array( 'jquery' ), '0.5.2' );
wp_enqueue_script( 'script-js', 'assets/js/script.js', array( 'jquery', 'jquery-smoothstate-js' ), '1.0.0' );

4- create a script.js in the theme folder ---- asset --- js and we putted this code :

<script type='text/javascript' src='wp-includes/js/jquery/jquery.js'></script>
<script type='text/javascript' src='assets/js/smoothstate.js'></script>
<script type='text/javascript' src='assets/js/script.js'></script>

( function( $ ) {

    $( function() { // Ready

        var settings = { 
            anchors: 'a'
        };

        $( '#page' ).smoothState( settings );
    } );

})( jQuery );

then we added the css found in the article in order to add an animation :

.site-content { -webkit-transition: -webkit-transform .28s, opacity .28s;

-ms-transition: -o-transform .28s, opacity .28s;

-o-transition: -o-transform .28s, opacity .28s;

transition: transform .28s, opacity .28s;

}

Please help us ... and if you do, be as clear as possible, we are two beginners and we need clear instructions without confusion. What is wrong with what we did ? We searched the whole internet on how to add JS library in wordpress and that's all we found. Why it is not working ?

Thank you in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!