Brad Williams - Professional WordPress Plugin Development

Здесь есть возможность читать онлайн «Brad Williams - Professional WordPress Plugin Development» — ознакомительный отрывок электронной книги совершенно бесплатно, а после прочтения отрывка купить полную версию. В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: unrecognised, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Professional WordPress Plugin Development: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Professional WordPress Plugin Development»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

Extend WordPress with plugins using this advanced WordPress development book, updated for the current version This significantly updated edition of
addresses modern plugin development for WordPress, the highly popular content management system (CMS). If you’re using WordPress to create and manage websites, WordPress plugins are the software that can extend or enhance CMS functionality. This book offers guidance on writing plugins for WordPress sites to share or sell to other users.
The second edition of
covers the building of advanced plugin development scenarios. It discusses the plugin framework and coding standards as well as dashboards, settings, menus, and related application programming interfaces (APIs). Additional topics include security, performance, data validation, and SQL statements.
• Learn about the power of hooks in WordPress
• Discover how JavaScript and Ajax will work in your site
• Understand key technologies: Block Editor/Gutenberg, JS/React, PHP, and the REST API
• Create and use custom post types and taxonomies.
• Creating custom dashboard menus and plugin settings
• Work with users and user data
• Schedule tasks and utilizing Cron
• Performance and security considerations
Written by experienced plugin developers,
also helps you internationalize and localize your WordPress website. Find out about debugging systems and optimizing your site for speed. As WordPress use continues to increase, you can elevate your professional knowledge of how to extend WordPress through plugins.

Professional WordPress Plugin Development — читать онлайн ознакомительный отрывок

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Professional WordPress Plugin Development», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать
SOURCE CODE 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. 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. ERRATA 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.

4 1 An Introduction to Plugins 1 An Introduction to Plugins 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. WHAT IS A PLUGIN? WHAT IS A PLUGIN? 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 set of features, to WordPress. Plugins can range in complexity from a simple social networking plugin to an extremely elaborate eCommerce package. There is no limit to what a plugin can do in WordPress; because of this, there is no shortage of plugins available for download. AVAILABLE PLUGINS AVAILABLE PLUGINS When researching available plugins, you need to know where to find WordPress plugins. You can download plugins from many places on the Internet, but this isn't always a good idea. WARNING As with any software, downloading plugins from an untrusted source could lead to malware‐injected and compromised plugin files. It's best to download plugins only from trusted websites and official sources such as the official Plugin Directory. ADVANTAGES OF PLUGINS ADVANTAGES OF PLUGINS WordPress offers many advantages when using plugins. It's important to understand the advantages of building plugins to truly understand why you should spend time building them. This can also help when determining the need for a specific plugin in WordPress. INSTALLING AND MANAGING PLUGINS INSTALLING AND MANAGING PLUGINS All plugin management in WordPress happens on the Plugins screen in the WordPress Dashboard. The menu shown in Figure 1‐2 is available only to administrators in WordPress, so non‐administrators cannot see this menu. If you use the Multisite feature of WordPress, the Plugins menu is hidden by default. You need to enable the menu using My Sites ➪ Network Admin ➪ Settings. FIGURE 1‐2 : Plugins menu SUMMARY SUMMARY In this chapter, you learned about plugins and how they can interact with WordPress using the available APIs. The major advantages to using plugins and why plugin functionality shouldn't always be included in a theme were discussed. Installing and managing plugins in the WordPress Dashboard was covered. Now that you understand how plugins work in WordPress, it's time to create the plugin foundation!

5 2 Plugin Framework 2 Plugin Framework WHAT'S IN THIS CHAPTER? Creating a solid plugin foundation Determining directory and URL paths Creating activation and deactivation functions Cleaning up during the uninstall process Writing code following coding standards Properly documenting plugin code REQUIREMENTS FOR PLUGINS REQUIREMENTS FOR PLUGINS The WordPress plugin system is flexible and allows for plugins to be either a single file or a folder with many files. In this section, you'll learn the basics of creating a plugin. BEST PRACTICES BEST PRACTICES With any code base, developers should follow a common set of best practices. This is no different with WordPress plugins. By strictly following the practices laid out in this section, you'll have a solid foundation for your plugin. You'll also learn how to organize your plugin files and subfolders. PLUGIN HEADER PLUGIN HEADER For WordPress to recognize a plugin, the plugin's primary PHP file must have what's called a plugin header at the top of the file. This tells WordPress that this particular file is the file that it must load to your plugin. WordPress plugins can be and do anything, but this is the only hard requirement for a plugin to function. DETERMINING PATHS DETERMINING PATHS Perhaps one of the toughest hurdles to jump when building WordPress plugins is simply figuring out the appropriate path when loading or referencing a file. Because you as a plugin developer do not control how the user chooses to set up their WordPress installation, you cannot rely on a specific pattern. ACTIVATE/DEACTIVATE FUNCTIONS ACTIVATE/DEACTIVATE FUNCTIONS WordPress provides standard activation and deactivation hooks that allow any plugin to run code when it is activated or deactivated, respectively. This section walks through how to use both. UNINSTALL METHODS UNINSTALL METHODS Cleaning up anything left behind when a user uninstalls your plugin is an important aspect of developing plugins professionally. Running an uninstall procedure takes little work on your part but makes sure that users can trust that they can use your plugins without those plugins leaving unwanted data behind. CODING STANDARDS CODING STANDARDS Following a set of standards when developing plugins professionally is important because it makes long‐term maintenance of your code easier and also allows other developers to quickly learn from or contribute to your plugin. WordPress maintains a coding standard for the core source code. It is a good starting point when building plugins. You can view the WordPress coding standards at https://make.wordpress.org/core/handbook/best-practices/coding-standards . WordPress has more than 15 years of legacy code, and sometimes its standards do not align with the standards of the larger PHP community. This can be off‐putting for some PHP developers new to the WordPress community. You may also want to follow PHP Recommended Standards (PSRs) created and maintained by the PHP Framework Interprop Group (PHP‐FIG) for the larger PHP community. You can find these standards at https://www.php-fig.org/psr . The most important thing is to maintain consistency in your code base, regardless of the coding standards that you follow. SUMMARY SUMMARY This chapter covered how to properly set up your WordPress plugin. Following the methods and techniques outlined in this chapter will set you on the path to building plugins professionally. Starting from a solid foundation by following coding standards and documenting your code will make it easier to maintain your plugin in the long term. It will also help other developers understand your code. It's important to get the foundation right before moving on to more advanced topics.

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Professional WordPress Plugin Development»

Представляем Вашему вниманию похожие книги на «Professional WordPress Plugin Development» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Professional WordPress Plugin Development»

Обсуждение, отзывы о книге «Professional WordPress Plugin Development» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x