INTRODUCTION

Dear reader, thank you for picking up this book! You have probably heard about WordPress already, the most popular self‐hosted content management system (CMS) and blogging software in use today. WordPress powers literally millions of websites on the Internet, including high‐profile sites such as TechCrunch and multiple Microsoft websites. What makes WordPress so popular is that it's free, open source, and extendable beyond limits. Thanks to a powerful, architecturally sound, and easy‐to‐use plugin system, you can customize how WordPress works and extend its functionalities. There are already more than 55,000 plugins freely available in the official plugin repository, but they won't suit all your needs or client requests. That's where this book comes in handy!

As of this writing, we (Brad, Justin, and John) have publicly released more than 100 plugins, which have been downloaded millions of times, and that's not counting private client work. This is a precious combined experience that we are going to leverage to teach you how to code your own plugins for WordPress by taking a hands‐on approach with practical examples and real‐life situations you will encounter with your clients.

The primary reason we wanted to write this book is to create a preeminent resource for WordPress plugin developers. When creating plugins for WordPress, it can be a challenge to find the resources needed in a single place. Many of the online tutorials and guides are outdated and recommend incorrect methods for plugin development. This book is one of the most extensive collections of plugin development information to date and should be considered required reading for anyone wanting to explore WordPress plugin development from the ground up.

WHO THIS BOOK IS FOR

This book is for professional web developers who want to make WordPress work exactly how they and their clients want. WordPress has already proven an exceptional platform for building any type of site from simple static pages to networks of full‐featured communities. Learning how to code plugins will help you get the most out of WordPress and have a cost‐effective approach to developing per‐client features.

This book is also for the code freelancers who want to broaden their skill portfolio, understand the inner workings of WordPress functionality, and take on WordPress gigs. Since WordPress is the most popular software to code and power websites, it is crucial that you understand how things run under the hood and how you can make the engine work your way. Learning how to code plugins will be a priceless asset to add to your résumé and business card.

Finally, this book is for hobbyist PHP programmers who want to tinker with how their WordPress blog works, discover the infinite potential of lean and flexible source code, and learn how they can interact with the flow of events. The beauty of open source is that it's easy to learn from and easy to give back in turn. This book will help you take your first step into a community that will welcome your creativity and contribution.

Simply put, this book is for anyone who wants to extend the way WordPress works, whether it is for fun or profit.

WHAT YOU NEED TO USE THIS BOOK

This book assumes you already have a web server and WordPress running. For your convenience, it is preferred that your web server runs on your localhost, as it will be easier to modify plugin files as you read through the book, but an online server is also fine.

Code snippets written in PHP are the backbone of this book. You should be comfortable with reading and writing basic PHP code or referring to PHP's documentation to fill any gaps in knowledge about fundamental functions. Advanced PHP code tricks are explained, so you don't need to be a PHP expert.

You will need to have rudimentary HTML knowledge to fully understand all the code. A basic acquaintance with database and MySQL syntax will help with grasping advanced subjects. To make the most of the chapter dedicated to JavaScript and Ajax, comprehension of JavaScript code will be a plus.

WHAT THIS BOOK COVERS

As of this writing, WordPress 5.5 is around the corner, and this book has been developed alongside this version. Following the best coding practices outlined in this book and using built‐in APIs are keys to future‐proof code that will not be deprecated when a newer version of WordPress is released. We believe that every code snippet in this book will still be accurate and up‐to‐date for several years, just as several plugins we coded many years ago are still completely functional today.

HOW THIS BOOK IS STRUCTURED

This book is, to date, one of the most powerful and comprehensive resources you can find about WordPress plugins. Advanced areas of the many WordPress APIs are covered, such as the REST API, cron jobs, and custom post types. This book is divided into three major parts. Reading the first five chapters is required if you are taking your first steps in the wonders of WordPress plugins. Chapters 6 through 9 will cover most common topics in coding plugins, and understanding them will be useful when reading subsequent chapters. The remaining chapters cover advanced APIs and functions, can be read in any order, and will sometimes refer to other chapters for details on a particular function.

CONVENTIONS

To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.

As for styles in the text:

  • We italicize new terms and important words when we introduce them.
  • We show keyboard strokes like this: Ctrl+A.
  • We show filenames, URLs, and code within the text like so: persistence.properties.

We present code in two different ways:

We use a monofont type with no highlighting for most code examples.
We use bold to emphasize code that is particularly important in the present context or to show changes from a previous code snippet.

SOURCE CODE

As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All the source code used in this book is available for download at www.wiley.com/go/prowordpressdev2e on the Downloads tab.

ERRATA

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or faulty piece of code, we would be grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and at the same time, you will be helping us provide even higher‐quality information.

To find the errata page for this book, go to www.wiley.com and locate the title using the Search box. Then, on the book details page, click the Errata link. On this page, you can view all errata that have been submitted for this book and posted by editors. If you don't spot “your” error on the Errata page, go to support.wiley.com and follow the directions to contact technical support and open a ticket to submit the error. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent printings of the book.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.40.177