The best way to load custom scripts (JavaScript) and styles (CSS) into WordPress is to use the wp_enqueue_scripts hook. Rather than merely hard-coding scripts and styles into your Child Theme it is best to load them into this dynamic system so you can take precise control over where they load on your site. Not all scripts and styles are needed on every page, and it can be beneficial to your site’s overall speed to use PHP logic to add and remove them when needed. Using MD’s Scripts Manager can make this process even easier.

Code example:

function md_child_enqueue() {
    wp_enqueue_script( 'md-child-script-name' . '' );
    wp_enqueue_style( 'md-child-style-name' . '' );
add_action( 'wp_enqueue_scripts', 'md_child_enqueue' );

Learn more from the WordPress Developer Guide.

More WordPress and MD Terms

Explore the full glossary for more key phrases and definitions.




Always Keep Learning

Get New Definitions, MD Releases, and Other Downloads Sent to Your Email

Join the MD newsletter to get new website tools, strategies, and other bonus downloads sent to your email in a respectful manner. If you use Marketers Delight to power your website, you do not want to miss out on these emails!

November sale: Save 25% on all new licenses!