Skip to Content
WordPress® All-in-One For Dummies®
book

WordPress® All-in-One For Dummies®

by Lisa Sabin-Wilson, Cory Miller, Kevin Palmer, Andrea Rennick, Michael Torbert
April 2011
Beginner to intermediate content levelBeginner to intermediate
908 pages
22h 37m
English
For Dummies
Content preview from WordPress® All-in-One For Dummies®

Filtering Content

Now that you know how a plugin is created, it's time to have some fun and create a WordPress plugin that actually does something, and in the process, discover more basics of WordPress plugin development.

A powerful feature of WordPress is its numerous filters. By latching code to a filter, you can modify information as it flows through WordPress, and therefore modify the information WordPress displays or stores.

Imagine that you have a habit of using contractions far too often. Your readership mocks you and your penchant for the commoner practice of merging words together. At night, you worry about whether you missed an instance of it's, we're, or I'll.

It is causing you to lose sleep. You tried listening to the self-help tapes, you review every word and you have been to therapy to find the deep-seated cause of your craving for contractions. Despite your best efforts and the constant ridicule, you cannot help but sound like an etiquette contrarian.

Fortunately, there is a cure. With a simple filter and a bit of code, your grammatical ailment can be disguised easily with a simple WordPress plugin that you create in the next section of this chapter.

Setting up the plugin structure

The plugin we create in this section is Example: Contraction Compulsion Correction that will reside in a directory called /example-contraction-compulsion-correction with a main plugin file named init.php. Apply the same steps to create the directory and main plugin file as you did in the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

WordPress® 24-Hour Trainer

WordPress® 24-Hour Trainer

George Plumley
Gaming Hacks

Gaming Hacks

Simon Carless

Publisher Resources

ISBN: 9780470877012Purchase book