Professional WordPress Plugin Development. Brad Williams

Читать онлайн.
Название Professional WordPress Plugin Development
Автор произведения Brad Williams
Жанр Программы
Серия
Издательство Программы
Год выпуска 0
isbn 9781119666936



Скачать книгу

development from the ground up.

      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.

      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.

      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.

      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.

      WARNING Boxes with a warning label like this one hold important, not‐to‐be‐forgotten information that is directly relevant to the surrounding text.

      NOTE The note label indicates notes, tips, hints, tricks, and asides to the current discussion.

      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.

      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.

      NOTE Because many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is 978‐1‐119‐66694‐3.

      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.

      WHAT'S IN THIS CHAPTER?

       Understanding what a plugin is

       Using available WordPress APIs

       Finding examples of popular plugins

       Separating plugin and theme functionality

       Managing and installing plugins

       Understanding types of WordPress plugins

      WordPress is the most popular open source content management system available today. One of the primary reasons WordPress is so popular is the ease with which you can customize and extend WordPress through plugins. WordPress has an amazing framework in place that gives plugin developers the tools needed to extend WordPress in any way imaginable.

      Understanding how plugins work, and the tools available in WordPress, is critical knowledge when developing professional WordPress plugins.

      A plugin in WordPress is a PHP‐based script that extends or alters the core functionality of WordPress. Quite simply, plugins are files installed in WordPress to add a feature, or