WordPress Developer Tips: Enqueuing Styles and Scripts

38m 31s – Advanced

There’s a right way and a wrong way to add style sheets and JavaScript libraries and scripts to your WordPress themes. The right way takes advantage of the WordPress enqueue system, which prevents script and style conflicts. In this installment of WordPress Developer Tips, staff author Morten Rand-Hendriksen introduces the two main functions for enqueuing: wp_enqueue_style() and wp_enqueue_script(0). He’ll show how the functions work and how to adjust their parameters, as well as theoretical and practical examples of implementing them in themes. This course uses Simone, a theme developed especially for Morten’s WordPress: Building Themes from Scratch Using Underscores course, but you can use any theme or subtheme that you’d like.

Introduction – 1m 25s
Welcome – 1m 25s

1. Enqueueing Styles – 16m 43s
Why enqueue stylesheets? – 4m 0s
Introducing the wp_enqueue_style(); function – 4m 45s
Enqueueing the main theme stylesheet – 4m 2s
Enqueueing stylesheets conditionally – 3m 56s

2. Enqueueing Scripts – 19m 11s
Why enqueue scripts? – 2m 23s
Introducing the wp_enqueue_script(); function – 3m 54s
Enqueueing a standalone script – 2m 50s
Enqueueing a jQuery script – 3m 56s
Using script dependencies – 3m 18s
Enqueueing scripts conditionally – 2m 50s

Conclusion – 1m 12s
Exploring WordPress theme development with lynda.com – 1m 12s

Facebook Comments