functions.php tweaks

functions.php is a file located in your WordPress installations theme folder.
It uses PHP as coding language, and acts like a plugin.
With it a lot of things can be changed in wordpress, functionalities that otherwise would require installing a plugin, which we all know, adds a plus load time for teh website, which is not ok SEO wise 🙂
Below are a few examples:

Add a custom scss and js file

function my_style() {
wp_enqueue_style(‘main-styles’, get_stylesheet_directory_uri() . ‘/scss/custom.css’, array());
wp_enqueue_script(‘custom-js’, get_stylesheet_directory_uri(__FILE__) . ‘/js/my.js’, false, ‘1.0.0’);
}
add_action( ‘wp_enqueue_scripts’, ‘my_style’,99 );

NOTE: the below folders and files are located in your theme folder
/scss/custom.css
/js/my.js

More Posts