WordPress 3 Plugin Development Essentials

WordPress 3 Plugin Development Essentials
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Everything you need to know to develop your own plugins for WordPress
  • Walk through the development of five plugins from ground up
  • Prepare and release your plugins to the WordPress community
  • Avoid common mistakes made by most plugin developers by learning more advanced development patterns


Book Details

Language : English
Paperback : 300 pages [ 235mm x 191mm ]
Release Date : March 2011
ISBN : 184951352X
ISBN 13 : 9781849513524
Author(s) : Brian Bondari, Everett Griffiths
Topics and Technologies : All Books, CMS and eCommerce, WordPress

Table of Contents

Chapter 1: Preparing for WordPress Development
Chapter 2: Anatomy of a Plugin
Chapter 3: Social Bookmarking
Chapter 4: Ajax Search
Chapter 5: Content Rotator
Chapter 6: Standardized Custom Content
Chapter 7: Custom Post Types
Chapter 8: Versioning Your Code with Subversion (SVN)
Chapter 9: Preparing Your Plugin for Distribution
Chapter 10: Publishing Your Plugin
Appendix A: Recommended Resources
Appendix B: WordPress API Reference
  • Chapter 1: Preparing for WordPress Development
    • WordPress background
    • Extending WordPress
    • Understanding WordPress architecture
      • Templating
      • Introducing plugins
    • Summarizing architecture
    • Tools for web development
      • WordPress
      • Mac
      • Windows
      • Text editor
      • Using an IDE
      • FTP client
      • MySQL client
    • Coding best practices
    • Basic organization
      • Isolate tasks into functions
      • Use classes
      • Use descriptive variable names
      • Use descriptive function names
      • Separate logic and display layers
      • Go modular, to a point
      • Avoid short tags
    • Planning ahead / starting development
      • Interfaces
      • Localization
      • Documentation for the developer
      • Version control
      • Environment
      • Tests
      • Security
        • Printing user-supplied data to a page
        • Using user-supplied data to construct database queries
    • Debugging
      • Clearing your browser cache
      • Updating your php.ini file
      • Configuring your wp-config.php file
      • Checking your syntax
      • Checking values
      • Exercise
    • Summary
    • Chapter 2: Anatomy of a Plugin
      • Deconstructing an existing plugin: "Hello Dolly"
        • Activating the plugin
        • Examining the hello.php file
      • Information header
        • Exercise—breaking the header
        • Location, name, and format
      • Understanding the Includes
        • Exercise – parse errors
      • Bonus for the curious
      • User-defined functions
        • Exercise—an evil functionless plugin
        • What just happened
        • Omitting the closing "?>" PHP tag
        • A better example: Adding functions
      • Referencing hooks via add_action() and add_filter()
      • Actions versus Filters
        • Exercise—actions and filters
        • Exercise—filters
        • Reading more
      • Summary
      • Chapter 3: Social Bookmarking
        • The overall plan
        • Proof of concept
          • Avoiding conflicting function names
        • The master plugin outline
          • The plugin information header
            • In your browser—information header
          • Adding a link to the post content
            • Documenting our functions
            • In your browser—linking to the post content
          • Adding JavaScript to the head
            • Making our link dynamic
          • Adding a button template
          • Getting the post URL
            • In your browser—getting the post URL
          • Getting the post title
          • Getting the description
          • Getting the media type
          • Getting the post topic
            • In your browser—title, description, and topic
        • Checking WordPress versions
        • Summary
        • Chapter 4: Ajax Search
          • What is Ajax?
          • The overall plan
          • The proof of concept mock up
            • Hooking up jQuery
              • Test that jQuery has loaded
              • What happened?
              • Using the FireBug console directly
            • Writing HTML dynamically to a target div
              • Multi-line strings
              • Viewing the generated page
              • Anonymous functions
              • Adding a div on the fly
            • Create a listener
            • Fetching data from another page
          • Creating our plugin
            • Creating index.php and activating the plugin
            • Creating our first PHP class
            • Updating index.php
            • Testing your version of PHP
            • Testing for searchable pages
            • Adding your own CSS files
            • Adding your search handler
            • Adding your own JavaScript
            • Handling Ajax search requests
            • Formatting your search results
          • Summary
          • Chapter 5: Content Rotator
            • The plan
            • Widget overview
            • Preparation
              • Activating your plugin
              • Activating the widget
                • Having problems?
              • Parents and children: extending classes
              • Objects vs. libraries: when to use static functions
            • Add custom text
            • Adding widget options
            • Generating random content
            • Expiration dates: adding options to our widget
              • Expiration dates: enforcing the shelf life
              • Explaining the $instance
            • Adding a custom manager page
              • Adding options to the custom manager page
            • Randomizing content from the database
            • Review of PHP functions used
            • Summary
            • Chapter 6: Standardized Custom Content
              • What WordPress does for you: custom fields
              • What WordPress doesn't do for you
              • Standardizing a post's custom fields
              • Creating a new plugin
                • Removing the default WordPress form for custom fields
                • Creating our own custom meta box
                • Defining custom fields
                • Generating custom form elements
                • Saving custom content
              • Having trouble saving data?
              • Displaying custom data in your Templates
                • Copying a theme
                • Modifying the theme
                • Granular display of custom fields
                • Bonus for the MySQL curious
              • Known limitations
              • Summary
              • Chapter 7: Custom Post Types
                • Background: What's in a name?
                • Understanding register_post_type()
                • Customizing our post type
                  • Using shortcodes
                  • Testing our shortcode
                • Customizing our plugin
                • Creating a settings shortcut link
                • Cleaning up when uninstalling
                • Summary
                • Chapter 8: Versioning Your Code with Subversion (SVN)
                  • Why Subversion?
                    • Understanding the terminology and concepts
                    • Checking out a local working copy
                    • SVN folder structure
                    • Checkout, revisited
                  • Setting up an SVN repository
                  • Checking out a local working copy of our repo
                  • Adding files
                  • Committing changes to the repository
                  • Overcoming errors
                    • Verifying the new state of your repository
                    • Adding more files to your repository
                    • Removing files from the repository
                    • Updating your working copy
                    • Tagging a version
                    • Reverting an entire project
                    • Reverting a single file
                  • Moving files
                  • Exporting your working copy
                  • Quick reference
                  • Summary
                  • Chapter 9: Preparing Your Plugin for Distribution
                    • Public enemy number one: PHP notices
                    • PHP short tags
                    • Conflicting names
                    • Modifying loader.php
                    • Testing WordPress version
                    • Testing PHP version
                    • Testing MySQL version
                    • Testing PHP modules
                    • Testing WordPress installed plugins
                    • Custom tests
                    • Unit tests
                    • WordPress limitations
                    • Health check page
                    • Storing test results in the database
                    • Death to clippy: Use sensible configurations
                    • Double check your interface
                    • Documentation
                      • Identify the purpose
                      • Learning to drive: Keeping it relevant
                      • Phrasebooks vs. dictionaries: Give examples
                      • Analogy: The three bears
                      • Analogy: PC load letter
                    • The decalog of documentation
                    • Summary
                    • Chapter 10: Publishing Your Plugin
                      • Internationalization and localization
                      • Processing each message
                        • Choosing a textdomain
                      • Best practices
                      • Working with formatting
                      • More advanced messages
                      • Plural vs. singular
                      • More complex messages
                        • Notes to translators
                      • Language files
                      • Creating a POT file
                      • Creating translations: .po files
                      • Loading a textdomain
                      • Updating a translation
                      • Format for the readme.txt file
                        • Section – installation
                        • Section – Frequently Asked Questions
                        • Section – screenshots
                        • New addition – videos
                        • Section – summary
                      • Requesting and using SVN access
                      • Publicity and promotion
                      • Summary
                      • Appendix A: Recommended Resources
                        • PHP reference
                        • Function reference
                        • The WordPress forums
                        • WebDev Studios
                        • Viper007Bond
                        • Kovshenin
                        • SLTaylor
                        • XPlus3
                        • WP Engineer
                        • Other plugins
                        • Appendix B: WordPress API Reference
                          • PHP functions
                            • dirname
                            • file_get_contents
                            • preg_match
                            • preg_replace
                            • print_r
                            • sprintf
                            • strtolower
                            • substr
                          • WordPress Functions
                            • __
                            • _e
                            • add_action
                            • add_filter
                            • add_meta_box
                            • add_options_page
                            • check_admin_referer
                            • esc_html
                            • get_option
                            • get_post_meta
                            • get_the_ID
                            • register_post_type
                            • remove_meta_box
                            • screen_icon
                            • the_content
                            • the_meta
                            • update_post_meta
                            • wp_count_posts
                            • wp_die
                            • wp_nonce_field
                          • Actions
                            • admin_init
                            • admin_menu
                            • do_meta_boxes
                            • init
                            • save_post
                            • widgets_init
                            • wp_head
                          • Filters
                            • the_content

                          Brian Bondari

                          Brian Bondari is a musician, composer, and teacher with equal loves for both music and technology. His hobbies include reading, hiking, composing music, and playing with his pet rabbit. He also spends an exorbitant amount of time lying on the floor grading papers.

                          Brian earned his doctorate from the University of Kansas in 2009 and is currently an Assistant Professor of Music Theory and Composition at the University of Texas at Tyler. When he is not writing music or grading papers, he serves as Senior Editor for the multi-author technology blog, http://www.TipsFor.us.

                          You can also visit him at http://www.bondari.com.

                          Everett Griffiths

                          Everett Griffiths is a freelance PHP/Perl developer and database architect specializing in Content Management Systems and plugin development. His hobbies include playing guitar and running. He currently resides in Los Angeles with frequent trips abroad.

                          Sorry, we don't have any reviews for this title yet.

                          Code Downloads

                          Download the code and support files for this book.

                          Submit Errata

                          Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                          - 3 submitted: last submission 15 Jan 2014

                          Errata Type:Typo Page No:53

                          Second paragraph starts with "Our fist task" It should be "Our first task"

                          Errata Type: Code | Page no: 108

                          'description'    => $this->widget_desc

                          should be

                          'description' => $this->description

                          Errata Type: Code | Page no: 47

                          <input id="[+seconds_shelf_life.id+]" name="[+seconds_shelf_life.name+]" value="+seconds_shelf_life.value+]" />


                          should be


                          <input id="[+seconds_shelf_life.id+]" name="[+seconds_shelf_life.name+]" value="[+seconds_shelf_life.value+]" />

                          Sample chapters

                          You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                          Frequently bought together

                          WordPress 3 Plugin Development Essentials +    Implementing VMware vCenter Server =
                          50% Off
                          the second eBook
                          Price for both: £23.65

                          Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                          What you will learn from this book

                          • Get to know the WordPress code base, WordPress' plugin architecture, and the application programming interface (API)
                          • Integrate with third-party APIs and web services
                          • Hook into the WordPress internals using actions and filters
                          • Customize your WordPress Dashboard with menus and administration panels for your plugin
                          • Streamline user interactions by using jQuery to make AJAX requests
                          • Expand your understanding of WordPress as a CMS
                          • Implement localization support for users of other languages
                          • Maintain and manage your plugin using SVN and publish it to the WordPress Plugin Repository
                          • Write tests into your code to ensure that it is always deployed properly


                          In Detail

                          WordPress is one of the most popular platforms for building blogs and general websites. By learning how to develop and integrate your own plugins, you can add functionality and extend WordPress in any way imaginable. By tapping into the additional power and functionality that plugins provide, you can make your site easier to administer, add new features, or even alter the very nature of how WordPress works. Covering WordPress version 3, this book makes it super easy for you to build a variety of plugins.

                          WordPress 3 Plugin Development Essentials is a practical hands-on tutorial for learning how to create your own plugins for WordPress. Using best coding practices, this book will walk you through the design and creation of a variety of original plugins.

                          WordPress 3 Plugin Development Essentials focuses on teaching you all aspects of modern WordPress development. The book uses real and published WordPress plugins and follows their creation from the idea to the finishing touches in a series of easy-to-follow and informative steps. You will discover how to deconstruct an existing plugin, use the WordPress API in typical scenarios, hook into the database, version your code with SVN, and deploy your new plugin to the world.

                          Each new chapter introduces different features of WordPress and how to put them to good use, allowing you to gradually advance your knowledge. WordPress 3 Plugin Development Essentials is packed with information, tips, and examples that will help you gain comfort and confidence in your ability to harness and extend the power of WordPress via plugins.

                          A step-by-step guide for creating feature-rich plug-ins for WordPress


                          This book will provide an easy to understand, step-by-step approach to building your own WordPress plugins from scratch. We will construct a variety of plugins from the group up, demonstrating how to tap into a number of WordPress’ development aspects, as well as how to prepare and release your plugin(s) to the public.

                          Who this book is for

                          This book is for WordPress users who want to learn how to create their own plugins and for developers who are new to the WordPress platform. Basic knowledge of PHP and HTML is expected, as well as a functional knowledge of how WordPress works from a user standpoint.

                          Code Download and Errata
                          Packt Anytime, Anywhere
                          Register Books
                          Print Upgrades
                          eBook Downloads
                          Video Support
                          Contact Us
                          Awards Voting Nominations Previous Winners
                          Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                          Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software