Table of Contents
Preface 1
Chapter 1: Getting Started: WordPress and jQuery 7
This books approach 8
Core fundamentals you need to know 8
WordPress 9
Basic programming 10
JavaScript and AJAX techniques 10
PHP 11
Essential tools 13
CodeHTML editor 14
Firefox 16
Web Developer toolbar 16
Firebug 17
Not essential, but helpful: Image editor 18
jQuery background and essentials 19
What jQuery does really well 19
How we got here: From JavaScript to jQuery 20
Once upon a time, there was JavaScript 21
Why jQuery is simpler than JavaScript 22
Understanding the jQuery wrapper 23
Getting started with jQuery 25
Downloading from the jQuery site 26
Including the jQuery library 29
WordPress background and essentials 31
Overview of WordPress 31
Essentials for getting WordPress running 32
Using WAMP 33
www.it-ebooks.info
Table of Contents
[
ii
]
Using MAMP 33
Choosing a hosting provider 34
Rolling out WordPress 35
jQuery and WordPress: Putting it all together 35
Summary 37
Chapter 2: Working with jQuery in WordPress 39
Getting jQuery into WordPress 39
jQuery now comes bundled with WordPress 40
Registering jQuery in a WP theme 40
Avoiding problems registering jQuery 41
Using Googles CDN 42
Registering and including jQuery through Googles CDN into a theme 42
Using WordPress bundled jQuery versus including your own jQuery download or using Googles CDN
43
Keeping conflicts out 43
Setting your own jQuery variable 44
But I really want to use the variable 44
Launching a jQuery script 45
Our first WordPress and jQuery setup 45
Registering jQuery in our setup 46
Registering your own custom script file 46
Setting up the custom-jquery file 47
jQuery secret weapon 1: Using selectors and filters 47
Selecting anything you want from the document 48
Filtering those selections 53
Basic filters 54
Child filters 57
Content filters 58
Form filters 60
Attribute filters 62
Visibility 64
jQuery secret weapon 2: Manipulating CSS and elements in the DOM 65
Manipulating CSS 65
Manipulating attributes 67
Manipulating elements and content 68
Working with the DOM 71
jQuery secret weapon 3: Events and effects aka: the icing on the cake
72
Working with events 72
Helpers are so helpful 73
Working with bind, unbind, and the event object 75
www.it-ebooks.info
Table of Contents
[
iii
]
Adding effects 77
Showing and hiding 77
Sliding in and out 78
Fading in and out 78
Working with the animate function 79
Making it all easy with statement chaining 80
Our First Project: Expandingcollapsing WordPress posts 81
Keeping jQuery readable 83
Summary 83
Chapter 3: Digging Deeper: Understanding jQuery and WordPress Together