Glossary E 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:

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!


Get the latest MD sent straight to your inbox

There's always something new in the works in the MD Labs! Join the email list to get the newest content and releases sent straight to your inbox.*

Join the MD Newsletter

* I only email you when there's something new, or to share an exciting MD sneak peak.