![]() Just put below code to theme’s functions.php file. Using the Google CDN-hosted version of jQuery is another performance gain, because it will be cached for any visitors who have loaded another site that uses the same version. 2.1 Enqueue the Parent and Child Theme Stylesheets 2.2 Activating Your Child Theme 3 Modifying Your Theme’s CSS 4 Editing The Functions. In below code snippets we have unregistered the default jQuery library from default WordPress, then added the Google CDN version after closing the footer tag. The only required child theme file is style.css, but functions.php is necessary to enqueue styles correctly, check the. ![]() Here’s what the path should look like: child-theme-directory/js/follow.js Additional Speed Optimization Tips: This file includes the jQuery that will control the position of the sidebar follow section. In your Child Theme’s folder, create another folder called js, and then create a new file called follow.js and place that inside. '/js/follow.js', array( 'jquery' ), '', true ) Wp_enqueue_script( 'follow', get_stylesheet_directory_uri(). Enqueue sticky menu script - Crunchify TipsĪdd_action( 'wp_enqueue_scripts', 'crunchify_enqueue_script' ) Added wphead() and wpfooter() in header.php and footer.php file and make sure make file functions. Add below code to your child theme’s functions.php file. Starting from bootScore 5.3.0, all required scripts are disabled by default and are enabled. ![]() Here is a quick hook I’m using in my Genesis Framework theme for right sidebar sticky follow section. Place a copy of header.php in the child theme and modify the. ![]() It allows for greater control of when and where JS loads on your site. Using wp_enqueue_script is the best way to load JavaScript and jQuery into your WordPress template. The reason is pretty simple, HTTP/1.1 specification suggests that browsers not download more than two assets in parallel. Generally, it’s a good idea to include JavaScript / jQuery libraries and plugins at the bottom of the page, just before closing the body tag. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |