Enqueue
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:
<?php
function md_child_enqueue() {
wp_enqueue_script( 'md-child-script-name' . 'https://domain.com/script.js' );
wp_enqueue_style( 'md-child-style-name' . 'https://domain.com/style.css' );
}
add_action( 'wp_enqueue_scripts', 'md_child_enqueue' );
More WordPress and MD Terms
Explore the full glossary for more key phrases and definitions.
D
E
F
S
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!