WordPress Plugin Development Cookbook
Copyright 2012 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2012
Production Reference: 1190712
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-84951-768-3
www.packtpub.com
Cover Image by Andre Caron ( <>
)
Credits
Author
Yannick Lefebvre
Reviewers
Liina Buckingham
Joachim Kudish
Acquisition Editor
Usha Iyer
Lead Technical Editor
Sonali Tharwani
Technical Editors
Joyslita D'Souza
Veronica Fernandes
Copy Editor
Laxmi Subramanian
Project Coordinator
Michelle Quadros
Proofreaders
Aaron Nash
Mario Cecere
Indexer
Monica Ajmera Mehta
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
About the Author
Yannick Lefebvre is a plugin developer who has published eight projects to the official WordPress repository to this day. His first creation, Link Library, has been used on hundreds of sites around the world. With a background in Computer Science and working for Presagis a company providing software tools in the modeling and simulation industry he started writing plugins for his own WordPress site in 2004 and quickly started sharing his creations with the community. He is actively involved in the Montreal WordPress community and has presented multiple times at WordCamp Montreal. You can find out more about him and his plugins on his blog, Yannick's Corner (http://ylefebvre.ca).
I would like to thank the WordCamp Montreal organizers for giving me a chance to speak at multiple editions of the event, for creating great videos of the presentations, and giving me the opportunity to get involved in the community. This project would not have existed without them.
I would also like to thank Richard Archambault for his great feedback and encouragement during the writing process as well as the entire Packt Publishing team for proposing this great project to me and supporting me through the entire process.
Finally, I would like to thank my parents for always believing in me and encouraging me in all my projects.
About the Reviewers
Liina Buckingham has been developing websites since 2000. She is passionate about web usability, minimalistic design, and engaging content.
Joachim Kudish is a Web Developer specialized in WordPress development. He is currently employed at Automattic as a Code Wrangler. He works primarily at WordPress.com, while dabbling in several other of Automattic's web products. Previously, he was a freelancing web developer building high-scale WordPress sites and private WordPress plugins. He is author and contributor to several WordPress plugins as well as a contributor to WordPress core. He is originally from Montreal, Quebec but is currently located in Vancouver, BC. He is active in the local Vancouver WordPress community and is a regular WordCamp speaker.
Thank you Yannick for asking me to participate in the making of this book. It was a great learning experience and a true pleasure to be part of the project.
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at > for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why Subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print and bookmark content
- On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
To my wife, Andre, for her love, her patience throughout the writing process, and being a great first proofreader
To my daughters, velyne and Gabrielle, for always making me smile and giving the best hugs in the world
Preface
Developing plugins for WordPress is the next big thing for you if you are an administrator looking to enhance a personal site with custom functionality for which no plugin exists, a developer looking to enhance the WordPress platform with new ideas for the community, or a website designer building a specific project for a client. Learning how to create WordPress plugins will allow you to unleash the full potential of the most popular web content management system.
As an early WordPress adopter, I started building plugins to add functionality to my personal site. Once I got these new elements in place, I quickly realized that other users could benefit from these extensions, and started distributing them online. To this day, I always love hearing back from users of my creations and finding out how they have put them to use and what new functionality they think would make them even better.
While developing plugins might initially sound a little bit like black magic, this book shows you how easy creating plugins actually is through a series of step-by-step recipes. If you have previously added code to a theme's functions file, you may even be familiar with some of the mechanics explained in this book. With all of the information contained in this book, you will quickly be able to create your own plugins or dissect existing ones to add that extra bit of missing functionality that you require. Before you know, you'll be publishing your own creations to the official WordPress plugin repository!
Let's start learning how to cook up great WordPress plugins!
What this book covers