Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shawnkfinn/e3abb93ea7dff2d5854665343c7c060c to your computer and use it in GitHub Desktop.
Save shawnkfinn/e3abb93ea7dff2d5854665343c7c060c to your computer and use it in GitHub Desktop.
This dequeue's and unregisters styles/scripts from WordPress. You may then load your own. This is handy when changing handles/sources, concatenating and minifying through your child theme.
<?php // Copy and Paste snippet below into child-theme functions -- DELETE THIS LINE
add_action( 'wp_enqueue_scripts', 'skf_custom_scripts', 100 );
function skf_custom_scripts()
{
// Stylesheets
wp_dequeue_style( 'bootstrap' );
wp_deregister_style( 'bootstrap' );
wp_dequeue_style( 'style-responsive' );
wp_deregister_style( 'style-responsive' );
// Enqueue Child Stylesheets
wp_enqueue_style( 'font-sourcesanspro', "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200,200italic,300italic,300,400italic,600,600italic,700italic,700,900,900italic");
wp_enqueue_style( 'font-oswald', "https://fonts.googleapis.com/css?family=Oswald:400,300,700&subset=latin,latin-ext");
// Unenqueue Parent JS
wp_dequeue_script( 'jquery.visible' );
wp_deregister_script( 'jquery.visible' );
wp_dequeue_script( 'retina' );
wp_deregister_script( 'retina' );
wp_dequeue_script( 'jquery.sticky' );
wp_deregister_script( 'jquery.sticky' );
// Enqueue Child JS
// No need to register if not conditional loading
wp_enqueue_script( 'skf-main-js', get_stylesheet_directory_uri() . '/dist/skf-main.js' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment