WordPress Plugin Development: Beginner's Guide

WordPress Plugin Development: Beginner's Guide
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 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

Book Details

Language : English
Paperback : 296 pages [ 235mm x 191mm ]
Release Date : February 2009
ISBN : 1847193595
ISBN 13 : 9781847193599
Author(s) : Vladimir Prelovac
Topics and Technologies : All Books, CMS and eCommerce, AJAX, Beginner's Guides, Content Management (CMS), Open Source, Web Development, WordPress

Table of Contents

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

Vladimir Prelovac

Vladimir Prelovac is the author of many popular WordPress plugins and articles about WordPress optimization, security and maintenance. He actively uses WordPress platform as a base for Internet development strategy for small & mid-sized businesses.

For Vladimir, WordPress development is a full time job about which he happily blogs on his web site prelovac.com.

Contact Vladimir Prelovac

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.


- 6 submitted: last submission 19 Mar 2014

Errata type: Typo | Page number: 9

Search Engines Friendly
should be:
Search Engine Friendly

Errata type: Code | Page number: 58

the part of code:
$wp_live_blogroll_plugin_url = trailingslashit
(plugin_basename(__FILE__) );
should be:
$wp_live_blogroll_plugin_url =

Errata type: Code | Page number: 73

last line of the page:
WPLiveRoll_Handle ajax($link_url);
should be:

Errata type: Code | Page number: 83

3rd line:
function WPLiveRoll_Handle ajax($link_url)
should be:
function WPLiveRoll_HandleAjax($link_url)

Errata type: Typo | Page number: 85

As you may have noticeed
should be:
As you may have noticed

Errata type: Code | Page number: 170

Code error 1st line of page missing close bracket,
$this->plugin_url = trailingslashit( WP_PLUGIN_URL.'/'.
should be
$this->plugin_url = trailingslashit( WP_PLUGIN_URL ) .'/'.

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 Plugin Development: Beginner's Guide +    Microsoft SQL Server 2012 Integration Services: An Expert Cookbook =
50% Off
the second eBook
Price for both: £21.95

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's plug-in architecture, and the plug-in application programming interface (API) and learn how to hack it
  • Master the WordPress database and the API – access and manipulate data, handle user roles and permissions, posts, and so on
  • Hook into the rest of WordPress using actions and filters
  • Change the way your WordPress backend looks by customizing menus, submenus, and the plug-in admin panel
  • Integrate AJAX and jQuery into your plug-ins to dynamically generate content
  • Hook directly to WordPress edit pages and use AJAX to generate fast searches
  • Integrate your plug-in with WordPress panels and the tinyMCE editor
  • Access and work with third-party APIs like Flickr
  • Implement localization support for users of other languages
  • Maintain and manage your plug-in using SVN and publish it to the WordPress Plugin Repository
  • Handle security issues and make your plug-ins safer to use

We cover the development of six plug-ins from start to finish:

  • Digg-this: Adds a Digg This button to each post.
  • Live Blogroll: Adds a recent posts popup for each blog in your blogroll.
  • The Wall widget: Displays comments on the sidebar without reloading the page.
  • Snazzy Archives: Presents your site archives in a unique visual way.
  • Insights: Access your articles and Flickr images from within the WordPress edit page.
  • Post Types: Provides pre-defined post templates to quickly add a photo or a link to your blog.

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.

A fast-paced guide for PHP developers to creating feature-rich plug-ins for WordPress


This is a Packt Beginners Guide, which means it focuses on practical examples and has a fast-paced but friendly approach, with the opportunity to learn by experiment and play. Each chapter builds a practical plug-in from the ground up using step-by-step instructions. Individual sections show you how to code some functionality into your plug-in and follow up with a discussion of concepts.

Who this book is for

This book is for programmers working with WordPress, who want to develop custom plug-ins and to hack the code base. You need to be familiar with the basics of WordPress and PHP programming and believe that code is poetry; this book will handle the rest.

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