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
85
Two ways to plugin jQuery into a WordPress site 85
WordPress themes overview 86
WordPress plugins overview 88
jQuery plugins overview 89
The basics of a WordPress theme 91
Understanding the templates hierarchy 91
A whole new theme 94
The Loop 96
Tags and hooks 97
Conditional tags 99
Template include tags 100
Plugin hooks 100
Project: Editing the main loop and sidebar in the default theme 101
Changing the loop 102
Changing the sidebar 105
The basics of a WordPress plugin 107
Project: Writing a WordPress plugin to display author bios 109
Coding the plugin 110
Activating our plugin in WordPress 114
The basics of a jQuery plugin 115
Project: jQuery fade in a child div plugin 116
Extra credit: Adding your new jQuery plugin to your WordPress plugin 118
Putting it all together: Edit the theme or create a custom plugin? 120
Summary 121
Chapter 4: Doing a Lot More with Less: Making Use of Plugins for Both jQuery and WordPress
123
The project overview: Seamless event registration 124
What the client wants 124
Part 1: Getting everything set up 125
What well need 125
ColorBox 125
Cforms II 126
www.it-ebooks.info
Table of Contents
[
iv
]
Installing the WordPress plugin 127
Setting up the registration form with cforms II 127
Creating the register page using WordPress 3.0s custom menu option 130
Working with WordPress 3.0s custom menu option 132
Customizing the theme 134
Creating the custom page template 134
Creating the custom category template 137
Getting jQuery in on the game plan 141
Including the ColorBox plugin 142
Writing a custom jQuery script 143
Pulling it all together: One tiny cforms II hack required 145
Part 2: Form validation—make sure that whats submitted is right 147
The trick to client-side validation: Dont just tell them when its wrong 148
Blank input validation 149
Properly formatted e-mail validation 151
Final thoughts and project wrap up: Its all about graceful degrading 154
Summary 156
Chapter 5: jQuery Animation within WordPress 157