You are previewing WordPress Plugin Development.
O'Reilly logo
WordPress Plugin Development

Book Description

Build powerful, interactive plug-ins for your blog and to share online

  • Everything you need to create and distribute your own plug-ins following WordPress coding standards

  • Walk through the development of six complete, feature-rich, real-world plug-ins that are being used by thousands of WP users

  • Written by Vladimir Prelovac, WordPress expert and developer of WordPress plug-ins such as Smart YouTube and Plugin Central

  • Part of Packt's Beginners Guide series: expect step-by-step instructions with an emphasis on experimentation and tweaking code

In Detail

If you can write WordPress plug-ins, you can make WordPress do just about anything. From making the site easier to administer, to adding the odd tweak or new feature, to completely changing the way your blog works, plug-ins are the method WordPress offers to customize and extend its functionality. This book will show you how to build all sorts of WordPress plug-ins: admin plug-ins, Widgets, plug-ins that alter your post output, present custom "views" of your blog, and more.

WordPress Plug-in Development (Beginner’s Guide) focuses on teaching you all aspects of modern WordPress development. The book uses real and published WordPress plug-ins and follows their creation from the idea to the finishing touches, in a series of carefully picked, easy-to-follow tutorials. You will discover how to use the WordPress API in all typical situations, from displaying output on the site in the beginning to turning WordPress into a CMS in the last chapter. In Chapters 2 to 7 you will develop six concrete plug-ins and conquer all aspects of WordPress development.

Each new chapter and each new plug-in introduces different features of WordPress and how to put them to good use, allowing you to gradually advance your knowledge. This book is written as a guide to take your WordPress skills from the very beginning to the level where you are able to completely understand how WordPress works and how you can use it to your advantage.

Table of Contents

  1. WordPress Plugin Development
  2. Credits
  3. About the Author
  4. About the Reviewer
  5. Preface
    1. What This Book Covers
    2. Who is This Book For
    3. Conventions
    4. Reader Feedback
    5. Customer Support
      1. Downloading the Example Code for the Book
      2. Errata
      3. Piracy
      4. Questions
  6. 1. Preparing for WordPress Development
    1. How will you benefit?
      1. WordPress features
        1. More sites means more opportunities
        2. Big players use it
        3. Urgent response to security issues
        4. Flexibility
        5. Search engines friendly
        6. Easy to use
        7. Social aspect
      2. Plugins as tool for promotion
      3. Dogfooding WordPress plugins
    2. Challenges involved
      1. Development
      2. Security
      3. Work after development
        1. Localization
        2. Documentation
        3. Support
        4. Promotion
    3. Plugins developed in this book
      1. Digg This
      2. Live Blogroll
      3. The Wall
      4. Snazzy Archives
      5. Insights
      6. Post Types
      7. Development Goodies
    4. Tools for the job
      1. WordPress
      2. Text editor
      3. FTP client
      4. Web browser
        1. Firebug
        2. Ubiquity
        3. Screengrab
        4. IE tab
    5. Final notes
      1. Installing and managing plugins
      2. Searching documentation
    6. Summary
  7. 2. Social Bookmarking
    1. Plugging in your first plugin
    2. Time for action -Create your first plugin
      1. What just happened?
      2. The plugin information header
      3. Checking WordPress versions
      4. Checking the plugin
    3. Time for action -Testing the version check
      1. What just happened?
      2. Have a go Hero
    4. Displaying a Digg button
    5. Time for action -Implement a Digg link
      1. What just happened?
      2. Using the Digg API
          1. Submit URL:
          2. Submit URL Details:
      3. Acquiring post information
        1. Post permalink URL
      4. Editing the theme files
      5. Have a go Hero
    6. WordPress plugin hooks
    7. Time for action - Use a filter hook
      1. What just happened?
      2. WordPress hooks
        1. Filter hooks
        2. Action hooks
        3. Practical filters and actions examples
          1. Upper case titles
          2. Mailing list
          3. Changing core WordPress functionality
      3. Have a go Hero
    8. Adding a Digg button using JavaScript code
    9. Time for action -Implement a Digg button
      1. What just happened?
      2. Conditional Tags
    10. Styling the output
    11. Time for action -Use CSS to position the button
      1. What just happened?
      2. Have a go Hero
    12. Summary
  8. 3. Live Blogroll
    1. Starting up with the blogroll
    2. Time for action -Roll into the blogroll
      1. What just happened?
      2. RSS Feed Processing
    3. jQuery JavaScript library
      1. Implementing a mouse hover event in jQuery
    4. Time for action -Creating a hover event with jQuery
      1. What just happened?
      2. JavaScript and WordPress
        1. Initializing jQuery
        2. Expanding jQuery knowledge
      3. Creating the pop-up with CSS
    5. Time for action -Apply CSS to the popup
      1. What just happened?
    6. Demystifying Ajax
      1. Simple example of using Ajax
    7. Time for action -Use Ajax to dynamically retrieve feed posts
      1. What just happened?
      2. Using JavaScript with WordPress
      3. Parsing parameters using wp_localize_script
      4. Ajax and WordPress
        1. Ajax in admin panel
      5. jQuery.ajax method
    8. Time for action -Use advanced Ajax call
      1. What just happened?
      2. Ajax script security using nonces
    9. Time for action -Add a security nonce
      1. What just happened?
    10. Summary
  9. 4. The Wall
    1. The main concepts behind the Wall plugin
    2. Creating a widget
    3. Time for action -Create a 'Hello World!' widget
      1. What just happened?
      2. Register widgets with description
    4. Widget controls
    5. Time for action -Expanding the widget with controls
      1. What just happened?
      2. WordPress options
      3. Display widget control
      4. Handling widget input
      5. Handling widget output
    6. Create a WordPress page from the code
    7. Time for action -Insert a page
      1. What just happened?
    8. Handling user input
    9. Time for action -Create the wall comment form
      1. What just happened?
    10. Managing Ajax comment submit
    11. Time for action -Save the comments
      1. What just happened?
      2. Using Ajax to submit forms
      3. Saving comments in WordPress post
    12. Dynamically load comments
    13. Time for action -Display the comments
      1. What just happened?
      2. WordPress database query
      3. Comment output
      4. Displaying the comments
    14. Ajax security
    15. Time for action -Display the comments
      1. What just happened?
      2. Have a go Hero
    16. Summary
  10. 5. Snazzy Archives
    1. Using a class for plugin
    2. Time for action -Create a new plugin class
      1. What just happened?
    3. Showing template output with shortcodes
    4. Time for action -Use a shortcode
      1. What just happened?
      2. Shortcode API
        1. Enclosing shortcodes
      3. Custom templates
    5. Time for action -Create a custom template
      1. What just happened?
    6. Prepare archives
    7. Time for action -Show archives of posts
      1. What just happened?
      2. Get all posts from database
      3. Using a regular expression
      4. Retrieve comment count for a post
      5. Using output buffers
    8. Apply styling and jQuery to archives
    9. Time for action -Style the archive view
      1. What just happened?
    10. Time for action Use jQuery to allow user interaction
      1. What just happened?
      2. Have a go Hero
    11. Creating plugin options page
    12. Time for action Create an options page
      1. What just happened?
      2. Managing plugin options
      3. Handling options form
      4. Adding administration pages
    13. Use plugin options
    14. Time for action -Apply the plugin options
      1. What just happened?
    15. Caching the plugin output
    16. Time for action -Create archives cache
      1. What just happened?
      2. Have a go Hero
    17. Summary
  11. 6. Insights for WordPress
    1. Creating custom panels in the editor screen
    2. Time for action -Create a new plugin outline
      1. What just happened?
      2. Custom edit panels in WordPress
    3. Searching the posts
    4. Time for action -Display a list of matching posts
      1. What just happened?
    5. Interacting with tinyMCE
    6. Time for action -Insert the link into tinyMCE
      1. What just happened?
    7. Using Flickr API
    8. Time for action -Display Flickr photos
      1. What just happened?
      2. Using third-party solutions—phpFlickr
    9. Creating a tinyMCE plugin
    10. Time for action -Adding a button to tinyMCE
      1. What just happened?
      2. Create a functional tinyMCE plugin window
    11. Time for action -Open a tinyMCE window
      1. What just happened?
      2. Have a go hero
    12. Summary
  12. 7. Post Types
    1. Handling localization
    2. Time for action -Create plugin and add localization
      1. What just happened?
      2. Optimizing localization usage
      3. How does localization work?
    3. Adding a post template
    4. Time for action -Create 'add photo' post template
      1. What just happened?
      2. Backend CSS classes
    5. Handling file and image uploads
    6. Time for action -Handle uploaded image
      1. What just happened?
    7. Using custom fields
      1. Adding custom fields
      2. Retrieving custom fields
    8. Quick post a link
    9. Time for action -Add link template
      1. What just happened?
    10. Tinkering with WordPress backend menus
    11. Time for action -- Remove 'Link' from the Write page
      1. What just happened?
    12. Programming the Manage panel
    13. Time for action -Add post type column in the Manage panel
      1. What just happened?
      2. Modifying an existing column
      3. Manage screen search filter
    14. Time for action - Add a search filter box
      1. What just happened?
    15. Handling error messages
    16. Time for action -Adding support for errors
      1. What just happened?
    17. User roles and capabilities
    18. Time for action Add user capability checks
      1. What just happened?
      2. Have a go Hero
    19. Summary
  13. 8. Development Goodies
    1. Creating Localization files
    2. Time for action -- Create a POT file
      1. What just happened?
        1. Updating POT file
    3. Time for action -Perform translation
      1. What just happened?
        1. Updating translation
    4. Documentation and support
      1. Plugin readme file
    5. Time for action -Create a sample plugin readme.txt file
      1. What just happened?
      2. Sections of readme.txt
        1. General information
        2. Special codes
        3. Screenshots
        4. Installation instructions
      3. Plugin homepage
      4. Providing support
    6. Code management and plugin repository
      1. Requesting repository access
      2. Using SVN
    7. Time for action -- Manage a local repository using SVN
      1. What just happened?
        1. Tagging a new version
      2. Using WordPress development SVN
      3. Local copy of plugin repository
    8. Promotion
      1. Plugin promotion checklist
    9. General plugin development guidelines
      1. Security
      2. Performance
      3. Re-using resources
      4. Keeping API up-to-date
    10. WordPress MU development
    11. WordPress and GPL
    12. Online resources
      1. WordPress documentation (WordPress Codex)
      2. WordPress development news
        1. WordPress blog
        2. WordPress development updates
        3. WordPress Trac
        4. WordPress dev IRC channel
      3. Debugging and testing
        1. Unit testing
        2. Automated tests
      4. Mailing Lists
        1. WP hackers
        2. WP professionals
        3. Other mailing lists
      5. Podcasts
        1. WordCast
        2. WordPress Weekly
      6. Author's (Vladimir Prelovac's) web site
    13. Summary