Brian Messenlehner started his career as a software developer for the United States Marine Corps in 2000.
Meer over de auteursBuilding Web apps with WordPress
WordPress as an Application Framework
Paperback Engels 2019 2e druk 9781491990087Samenvatting
WordPress is much more than a blogging platform. If you have basic PHP, HTML, CSS, and JavaScript experience you can use WordPress to develop fast, scalable, secure, and highly customized web apps, mobile apps, web services, and multisite networks of websites. Along with core WordPress functions and database schema, you’ll learn how to build custom plugins, themes, and services for just about any kind of web or mobile application.
In this updated second edition, Brian Messenlehner and Jason Coleman cover new features and functionality added to WordPress up to version 5.4. All code examples in the book are available on GitHub.
- Compare WordPress with traditional app development frameworks
- Use themes for views and plugins for backend functionality
- Get suggestions for choosing or building WordPress plugins
- Register custom post types (CPTs) and taxonomies
- Manage user accounts and roles, and access user data
- Build asynchronous behaviors with jQuery
- Use WordPress to develop mobile apps for iOS and Android
- Integrate PHP libraries, external APIs, and web service plugins
- Collect payments through ecommerce and membership plugins
- Learn how to speed up and scale your WordPress app
- Extend the WordPress REST API and create custom endpoints
- Learn about WordPress Gutenberg blocks development
Specificaties
Lezersrecensies
Over Jason Coleman
Inhoudsopgave
Preface
Who This Book Is For
Who This Book Is Not For
What You’ll Learn
About the Code
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments
1. Building Web Apps with WordPress
What Is a Website?
What Is an App?
What Is a Web App?
Features of a Web App
Mobile Apps
Progressive Web Apps
Why Use WordPress?
You Are Already Using WordPress
Content Management Is Easy with WordPress
User Management Is Easy and Secure with WordPress
Plugins
Flexibility Is Important
Frequent Security Updates
Cost
Responses to Some Common Criticisms of WordPress
When Not to Use WordPress
You Plan to License or Sell Your Site’s Technology
Another Platform Will Get You “There” Faster
Flexibility Is Not Important to You
Your App Needs to Be Highly Real Time
WordPress as an Application Framework
WordPress Versus Model-View-Controller Frameworks
Anatomy of a WordPress App
What Is SchoolPress?
SchoolPress Runs on a WordPress Multisite Network
The SchoolPress Business Model
Membership Levels and User Roles
Classes Are BuddyPress Groups
Assignments Are a CPT
Submissions Are a (Sub)CPT for Assignments
Semesters Are a Taxonomy on the Class CPT
Departments Are a Taxonomy on the Class CPT
SchoolPress Has One Main Custom Plugin
SchoolPress Uses a Few Other Custom Plugins
SchoolPress Uses the Memberlite Theme
2. WordPress Basics
WordPress Directory Structure
Root Directory
/wp-admin
/wp-includes
/wp-content
WordPress Database Structure
wp_options
Functions Found in /wp-includes/option.php
wp_users
Functions Found in /wp-includes/…
wp_usermeta
wp_posts
Functions Found in /wp-includes/post.php
wp_postmeta
Functions Found in /wp-includes/post.php
wp_comments
Functions Found in /wp-includes/comment.php
wp_commentsmeta
Functions Found in /wp-includes/comment.php
wp_terms
Functions Found in /wp-includes/taxonomy.php
wp_termmeta
wp_term_taxonomy
/wp-includes/taxonomy.php
wp_term_relationships
Hooks: Actions and Filters
Actions
Filters
Development and Hosting Environments
Working Locally
Choosing a Web Host
Development, Staging, and Production Environments
Extending WordPress
3. Using WordPress Plugins
The General Public License, Version 2, License
Installing WordPress Plugins
Building Your Own Plugin
File Structure for an App Plugin
/adminpages/
/classes/
/css/
/js/
/images/
/includes/
/includes/lib/
/pages/
/services/
/scheduled/
/schoolpress.php
Add-Ons to Existing Plugins
Use Cases and Examples
The WordPress Loop
WordPress Global Variables
Free Plugins
Admin Columns
Advanced Custom Fields
BadgeOS
Posts 2 Posts
Members
W3 Total Cache
Yoast SEO
Premium Plugins
Gravity Forms
BackupBuddy
WP All Import
Community Plugins
BuddyPress
4. Themes
Themes Versus Plugins
Where to Place Code When Developing Apps
When Developing Plugins
Where to Place Code When Developing Themes
The Template Hierarchy
Page Templates
Sample Page Template
Using Hooks to Copy Templates
When Should You Use a Theme Template?
Theme-Related WordPress Functions
Using locate_template in Your Plugins
Style.css
Versioning Your Theme’s CSS Files
functions.php
Themes and CPTs
Popular Theme Frameworks
WordPress Theme Frameworks
Non-WordPress Theme Frameworks
Creating a Child Theme for Memberlite
Including Bootstrap in Your App’s Theme
Menus
Navigation Menus
Dynamic Menus
Responsive Design
Device and Display Detection in CSS
Device and Feature Detection in JavaScript
Device Detection in PHP
Final Note on Browser Detection
5. Custom Post Types, Post Metadata, and Taxonomies
Default Post Types and CPTs
Page
Post
Attachment
Revisions
Navigation Menu Item
Custom CSS
Changesets
oEmbed Cache
User Requests
Reusable Blocks
Defining and Registering CPTs
register_post_type( $post_type, $args );
What Is a Taxonomy and How Should I Use It?
Taxonomies Versus Post Meta
Creating Custom Taxonomies
register_taxonomy( $taxonomy, $object_type, $args )
register_taxonomy_for_object_type( $taxonomy, $object_type )
Using CPTs and Taxonomies in Your Themes and Plugins
The Theme Archive and Single Template Files
Good Old WP_Query and get_posts()
Metadata with CPTs
add_meta_box( $id, $title, $callback, $screen, $context, $priority, $callback_args )
Using Meta Boxes with the Block Editor
Custom Wrapper Classes for CPTs
Extending WP_Post Versus Wrapping It
Why Use Wrapper Classes?
Keep Your CPTs and Taxonomies Together
Keep It in the Wrapper Class
Wrapper Classes Read Better
6. Users, Roles, and Capabilities
Getting User Data
Add, Update, and Delete Users
Hooks and Filters
What Are Roles and Capabilities?
Checking a User’s Role and Capabilities
Creating Custom Roles and Capabilities
Extending the WP_User Class
Adding Registration and Profile Fields
Customizing the Users Table in the Dashboard
Plugins
Theme My Login
Hide the Admin Bar from Nonadministrators
Paid Memberships Pro
PMPro Register Helper
Members
WP User Fields
7. Working with WordPress APIs, Objects, and Helper Functions
Shortcode API
Shortcode Attributes
Nested Shortcodes
Removing Shortcodes
Other Useful Shortcode-Related Functions
Widgets API
Before You Add Your Own Widget
Adding Widgets
Defining a Widget Area
Embedding a Widget Outside of a Dynamic Sidebar
Dashboard Widgets API
Removing Dashboard Widgets
Adding Your Own Dashboard Widget
Settings API
Do You Really Need a Settings Page?
Could You Use a Hook or Filter Instead?
Use Standards When Adding Settings
Ignore Standards When Adding Settings
Rewrite API
Adding Rewrite Rules
Flushing Rewrite Rules
Other Rewrite Functions
WP-Cron
Adding Custom Intervals
Scheduling Single Events
Kicking Off Cron Jobs from the Server
Using Server Crons Only
WP Mail
Sending Nicer Emails with WordPress
File Header API
Adding File Headers to Your Own Files
Adding New Headers to Plugins and Themes
Heartbeat API
8. Secure WordPress
Why It’s Important
Security Basics
Update Frequently
Don’t Use the Username “admin”
Use a Strong Password
Examples of Bad Passwords
Examples of Good Passwords
Hardening WordPress
Don’t Allow Admins to Edit Plugins or Themes
Change Default Database Tables Prefix
Move wp-config.php
Hide Login Error Messages
Hide Your WordPress Version
Don’t Allow Logins via wp-login.php
Add Custom .htaccess Rules for Locking Down wp-admin
SSL Certificates and HTTPS
Installing an SSL Certificate on Your Server
WordPress Login and WordPress Administrator over SSL
Debugging HTTPS Issues
Avoiding SSL Errors with the “Nuclear Option”
Back Up Everything!
Scan, Scan, Scan!
Useful Security Plugins
Spam-Blocking Plugins
Backup Plugins
Firewall/Scanner Plugins
Login and Password-Protection Plugins
Writing Secure Code
Check User Capabilities
Custom SQL Statements
Data Validation, Sanitization, and Escaping
Nonces
9. JavaScript Frameworks and Workflow
What Is ECMAScript?
What Is ES6?
What Is ES9?
What Is ESNext?
What Is Ajax?
What Is JSON?
jQuery and WordPress
Enqueuing Other JavaScript Libraries
Where to Put Your Custom JavaScript
Ajax Calls with WordPress and jQuery
Managing Multiple Ajax Requests
Heartbeat API
WordPress Limitations with Asynchronous Processing
JavaScript Frameworks
Backbone.js
React
10. WordPress REST API
What Is a REST API?
API
REST
JSON
HTTP
Why Use the WordPress REST API?
Using the WordPress REST API V2
Discovery
Authentication
Routes and Endpoints
Requests
Responses
Adding Your Own Routes and Endpoints
register_rest_route( $namespace, $route, $args, $override );
Setting Up the WordPress Single Sign-On Plugin
Adding the /wp-sso/v1/check Route
Bundling Basic Authentication with Our Plugin
Using the Endpoint We Set Up to Check User Credentials
Popular Plugins Using the WordPress REST API
WooCommerce
BuddyPress
Paid Memberships Pro
11. Project Gutenberg, Blocks, and Custom Block Types
The WordPress Editor
The Classic Editor Plugin
Using Blocks for Content and Design
Using Blocks for Functionality
Creating Your Own Blocks
Minimal Block Example
Using Custom Blocks to Build App Experiences
Enabling the Block Editor in Your CPTs
Block Categories
The Homework Blocks
Limiting Blocks to Specific CPTs
Limiting CPTs to Specific Blocks
Block Templates
Saving Block Data to Post Meta
Tips
Enable WP_SCRIPT_DEBUG
Use filemtime() for the Script Version
More Tips
Learn JavaScript, Node.js, and React More Deeply
12. WordPress Multisite Networks
Why Multisite?
Why Not Multisite?
Multisite Alternatives
Multiple Authors or Categories on the Same WordPress Site
Custom Post Types
Totally Separate Sites
Use a WordPress Maintenance Service
Multitenancy
Setting Up a Multisite Network
Managing a Multisite Network
Dashboard
Sites
Users
Themes
Plugins
Settings
Updates
Multisite Database Structure
Networkwide Tables
Individual Site Tables
Shared Site Tables
Domain Mapping
Random Useful Multisite Plugins
Gravity Forms User Registration Add-On
Member Network Sites Add-On for Paid Memberships Pro
More Privacy Options
Multisite Global Media
Multisite Plugin Manager
Multisite Global Search
Multisite Robots.txt Manager
NS Cloner: Site Copier
WP Multi Network
Basic Multisite Functionality
$blog_id
is_multisite()
get_current_blog_id()
switch_to_blog( $new_blog )
restore_current_blog()
get_blog_details( $fields = null, $get_all = true )
update_blog_details( $blog_id, $details = array() )
get_blog_status( $id, $pref )
update_blog_status( $blog_id, $pref, $value )
get_blog_option( $id, $option, $default = false )
update_blog_option( $id, $option, $value )
delete_blog_option( $id, $option )
get_blog_post( $blog_id, $post_id )
add_user_to_blog( $blog_id, $user_id, $role )
wpmu_delete_user( $user_id )
create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 )
Functions We Didn’t Mention
13. Localizing WordPress Apps
Do You Even Need to Localize Your App?
How Localization Is Done in WordPress
Defining Your Locale in WordPress
Text Domains
Setting the Text Domain
Prepping Your Strings with Translation Functions
__( $text, $domain = “default” )
_e( $text, $domain = “default” )
_x( $text, $context, $domain = “default” )
_ex( $title, $context, $domain = “default” )
Escaping and Translating at the Same Time
Creating and Loading Translation Files
Our File Structure for Localization
Generating a .pot File
Creating a .po File
Creating a .mo File
GlotPress
Using GlotPress for Your WordPress.org Plugins and Themes
Creating Your Own GlotPress Server
14. WordPress Optimization and Scaling
Terms
Origin Versus Edge
Testing
What to Test
Chrome Debug Bar
The WordPress Site Health Tool
Apache Bench
Siege
W3 Total Cache
Page Cache Settings
Minify
Database Caching
Object Cache
CDNs
GZIP Compression
Hosting
WordPress-Specific Hosts
Rolling Your Own Server
Selective Caching
The Transient API
Multisite Transients
Using JavaScript to Increase Performance
Custom Tables
Bypassing WordPress
15. Ecommerce
Choosing a Plugin
WooCommerce
Paid Memberships Pro
Easy Digital Downloads
Payment Gateways
Merchant Accounts
Setting Up SaaS with Paid Memberships Pro
The SaaS Model
Step 0: Establishing How You Want to Charge for Your App
Step 1: Installing and Activating Paid Memberships Pro
Step 2: Setting Up the Level
Step 3: Setting Up Pages
Step 4: Choosing Payment Settings
Step 5: Choosing Email Settings
Step 6: Choosing Advanced Settings
Step 7: Locking Down Pages
Step 8: Customizing Paid Memberships Pro
16. Mobile Apps Powered by WordPress
Mobile App Use Cases
Native and Hybrid Mobile Apps
What Is a Native Mobile App?
What Is a Hybrid Mobile App?
Why Hybrid over Native?
Cordova
Ionic Framework
App Wrapper
AppPresser
17. PHP Libraries, Web Service Integrations, and Platform Migrations
PHP Libraries
Image Generation and Manipulation
PDF Generation
Geolocation and Geotargeting
File Compression and Archiving
Developer Tools
External APIs and Web Services
Elasticsearch
ElasticPress by 10up
Google Vision
Google Maps
Google Translate
Twilio
Other Popular APIs
Migrations
Host Migrations
Platform Migrations
Create a Data Mapping Guide
18. The Future
Where We’ve Been
The REST API
WordPress Plugins Will Focus More on APIs
Headless WordPress
GraphQL
Gutenberg
The Administrator Interface Will Move to React/Gutenberg
Gutenberg Will Power a Frontend Editing Experience for WordPress
Block Templates Will Replace Themes
Blocks Will Replace Plugins
WordPress Market Share Will Increase and Decrease
WordPress Will Become a More Popular Platform for Mobile Development
WordPress Will Continue to Be Useful for Developing Apps of All Kinds
Index
Rubrieken
- advisering
- algemeen management
- coaching en trainen
- communicatie en media
- economie
- financieel management
- inkoop en logistiek
- internet en social media
- it-management / ict
- juridisch
- leiderschap
- marketing
- mens en maatschappij
- non-profit
- ondernemen
- organisatiekunde
- personal finance
- personeelsmanagement
- persoonlijke effectiviteit
- projectmanagement
- psychologie
- reclame en verkoop
- strategisch management
- verandermanagement
- werk en loopbaan