You are previewing WordPress Web Application Development.
O'Reilly logo
WordPress Web Application Development

Book Description

Everyone it seems loves WordPress and this is your opportunity to take your existing design and development skills to the next stage. Learn in easy stages how to speedily build leading-edge web applications from scratch.

  • Develop powerful web applications rapidly with WordPress

  • Practical scenario-based approach with ready-to-test source code

  • Learning how to plan complex web applications from scratch

  • In Detail

    Developing WordPress-powered websites is one of the standout trends in the modern web development world. The flexibility and power of the built-in features offered by WordPress has made developers turn their attentions to the possibility of using it as a web development framework. This book will act as a comprehensive resource for building web applications with this amazing framework.

    "WordPress Web Application Development" is a comprehensive guide focused on incorporating the existing features of WordPress into typical web development. This book is structured towards building a complete web application from scratch. With this book, you will build an application with a modularized structure supported by the latest trending technologies.

    "Wordpress Web Application Development" provides a comprehensive, practical, and example-based approach for pushing the limits of WordPress for web applications beyond your imagination.

    This book begins by exploring the role of existing WordPress components and discussing the reasons for choosing WordPress for web application development. As we proceed, more focus will be put into adapting WordPress features into web applications with the help of an informal use-case-based model for discussing the most prominent built-in features. While striving for web development with WordPress, you will also learn about the integration of popular client-side technologies such as Backbone, Underscore, and jQuery, and server-side technologies and techniques such as template engines, RSS feeds, Open Auth integration, and more.

    After reading this book, you will possess the ability to develop powerful web applications rapidly within limited time frames with the crucial advantage of benefitting low-budget and time-critical projects.

    Table of Contents

    1. WordPress Web Application Development
      1. Table of Contents
      2. WordPress Web Application Development
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. WordPress As a Web Application Framework
        1. WordPress as a CMS
        2. WordPress as a web development framework
          1. MVC versus event-driven architecture
        3. Simplifying development with built-in modules
        4. Identifying the components of WordPress
          1. The role of the WordPress theme
            1. The structure of a WordPress page layout
            2. Customizing the application layout
          2. The role of the admin dashboard
            1. Admin dashboard
            2. Posts and pages
            3. Users
            4. Appearance
            5. Settings
          3. The role of plugins
          4. The role of widgets
        5. A development plan for a portfolio management application
          1. Application goals and a target audience
          2. Planning the application
          3. User roles of the application
          4. Planning application features and functions
        6. Understanding limitations and sticking with guidelines
        7. Building a question-answer interface
          1. Prerequisites
          2. Creating questions
          3. Changing the status of answers
          4. Saving the status of answers
          5. Generating the question list
        8. Summary
      9. 2. Implementing Membership Roles, Permissions, and Features
        1. Introduction to user management
          1. Preparing the plugin
        2. Getting started on user roles
          1. Creating user roles for a application
            1. What is the best action for adding user roles?
          2. Knowing the default roles
            1. How to choose between default and custom roles?
              1. Scenario 1
              2. Scenario 2
            2. Removing existing user roles
        3. Understanding user capabilities
          1. Creating your first capability
          2. Understanding default capabilities
        4. Registering application users
        5. Implementing the frontend registration
          1. Shortcode implementation
            1. Pros and cons of using shortcodes
          2. Page template implementation
            1. Pros and cons of page templates
          3. Custom template implementation
          4. Building a simple router for user modules
            1. Creating the routing rules
            2. Adding query variables
            3. Flushing the rewriting rules
          5. Controlling access to your functions
            1. What are the advantages of using do_action?
          6. Creating custom templates
          7. Designing the registration form
          8. Planning the registration process
          9. Handling registration form submission
          10. Activating system users
        6. Creating a login on the frontend
          1. Displaying a login form
        7. Time to practice
        8. Summary
      10. 3. Planning and Customizing the Core Database
        1. Understanding the WordPress database
        2. Exploring the role of existing tables
          1. User-related tables
          2. Post-related tables
          3. Term-related tables
          4. Other tables
        3. Adapting existing tables into web applications
          1. User-related tables
          2. Post-related tables
            1. Scenario 1 – an online shopping cart
            2. Scenario 2 – hotel reservation system
            3. Scenario 3 – project management application
          3. Term-related tables
          4. Other tables
        4. Extending a database with custom tables
        5. Planning the portfolio application tables
          1. Types of tables in web applications
          2. Creating custom tables
        6. Querying the database
          1. Querying the existing tables
            1. Inserting records
            2. Updating records
            3. Deleting records
            4. Selecting records
          2. Querying the custom tables
          3. Working with posts
          4. Extending WP_Query for applications
        7. Limitations and considerations
          1. Transaction support
          2. Post revisions
            1. How to know whether to enable or disable revisions
          3. Autosaving
          4. Using metatables
        8. Summary
      11. 4. The Building Blocks of Web Applications
        1. Introduction to custom content types
          1. The role of custom post types in web applications
        2. Planning custom post types for the application
          1. Projects
          2. Services
          3. Articles
          4. Books
        3. Implementing custom post types for a portfolio application
          1. Implementing the custom post type settings
          2. Creating a projects class
            1. Assigning permissions to projects
          3. Creating custom taxonomies for technologies and types
            1. Assigning permissions to project type
          4. Introduction to custom fields with meta boxes
        4. What is a template engine?
          1. Configuring Twig templates
          2. Creating your first Twig template
        5. Persisting custom field data
          1. Customizing custom post type messages
          2. Passing data to Twig templates
        6. Introduction to custom post type relationships
        7. Pods framework for custom content types
          1. Should you choose Pods for web development?
        8. Time to practice
        9. Summary
      12. 5. Developing Pluggable Modules
        1. A brief introduction to WordPress plugins
          1. Understanding the WordPress plugin architecture
        2. WordPress plugins for web development
          1. Create reusable libraries with plugins
            1. How to use AJAX in WordPress
            2. Creating an AJAX request using jQuery
            3. Defining AJAX requests
              1. Drawbacks in a normal process
            4. Planning the AJAX plugin
            5. Creating the plugin
            6. Including plugin scripts for AJAX
            7. Creating reusable AJAX requests
          2. Extensible plugins
            1. Planning the file uploader for portfolio application
            2. Creating the extensible file uploader plugin
            3. Converting file fields with jQuery
            4. Integrating the media uploader to buttons
            5. Extending the file uploader plugin
            6. Customizing the allowed types of images
            7. Saving and loading project screens
          3. Pluggable plugins
        3. Time to practice
        4. Summary
      13. 6. Customizing the Dashboard for Powerful Backends
        1. Understanding the admin dashboard
        2. Customizing the admin toolbar
          1. Removing the admin toolbar
          2. Managing the admin toolbar items
        3. Customizing the main navigation menu
          1. Creating new menu items
        4. Adding features with custom pages
          1. Building options pages
            1. Automating option pages with SMOF
          2. Customizing the options page to use as a generic settings page
          3. Building the application options panel
          4. Using the WordPress Options API
        5. Using feature-packed admin list tables
          1. Building extended lists
          2. Using an admin list table for following developers
            1. Step 1 – defining the custom class
            2. Step 2 – defining instance variables
            3. Step 3 – creating the initial configurations
            4. Step 4 – implementing custom column handlers
            5. Step 5 – implementing column default handlers
            6. Step 6 – displaying the checkbox for records
            7. Step 7 – listing the available custom columns
            8. Step 8 – defining the sortable columns of the list
            9. Step 9 – creating a list of bulk actions
            10. Step 10 – retrieving list data
            11. Step 11 – adding the custom list as a menu page
            12. Step 12 – displaying the generated list
        6. An awesome visual presentation for the admin dashboard
        7. The responsive nature of the admin dashboard
        8. Time for action
        9. Summary
      14. 7. Adjusting Themes for Amazing Frontends
        1. Introduction to a WordPress application's frontend
          1. Basic file structure of a WordPress theme
          2. Understanding template execution hierarchy
        2. Template execution process of web application frameworks
        3. Web application layout creation techniques
          1. Shortcodes and page templates
          2. Custom templates with custom routing
            1. Using pure PHP templates
            2. The WordPress way of using templates
            3. Direct template inclusion
            4. Theme versus plugin templates
              1. Are you planning to create an application-specific theme?
            5. Template engines
        4. Building a portfolio application's home page
          1. What is a widget?
        5. Widgetizing application layouts
          1. Creating widgets
        6. Creating a custom template loader
        7. Designing the home page template
        8. Generating an application's frontend menu
          1. Creating a navigation menu
          2. Displaying user-specific menus on the frontend
        9. Creating pluggable and extendable templates
          1. Pluggable or extendable templates
          2. Extendable templates in web applications
          3. Pluggable templates in WordPress
          4. Comparing WordPress templates with Twig templates
        10. Extending the home page template with action hooks
          1. Customize widgets to enable extendable locations
        11. Planning action hooks for layouts
        12. Time for action
        13. Summary
      15. 8. Enhancing the Power of Open Source Libraries and Plugins
        1. Why choose open source libraries?
        2. Open source libraries inside the WordPress core
        3. Open source JavaScript libraries in the WordPress core
          1. What is Backbone.js?
          2. Understanding the importance of code structuring
          3. Integrating Backbone.js and Underscore.js
          4. Creating a developer profile page with Backbone.js
            1. Structuring with Backbone.js and Underscore.js
            2. Displaying the projects list on page load
            3. Creating new projects from the frontend
            4. Integrating events to the Backbone.js views
            5. Validating and creating new models on the server
            6. Creating new models on the server
        4. Using PHPMailer for custom e-mail sending
          1. Usage of PHPMailer within the WordPress core
            1. Creating a custom version of the pluggable wp_mail function
            2. Loading PHPMailer inside plugins and creating custom functions
        5. Implementing user authentication with Opauth
          1. Configuring login strategies
          2. Building a LinkedIn app
          3. Process of requesting the strategies
          4. Initializing the Opauth library
          5. Authenticating users in our application
        6. Using third-party libraries and plugins
        7. Time for action
        8. Summary
      16. 9. Listening to Third-party Applications
        1. Introduction to APIs
          1. Advantages of having an API
        2. WordPress XML-RPC API for web applications
        3. Building the API client
        4. Creating a custom API
        5. Integrating API user authentication
        6. Integrating API access tokens
        7. Providing the API documentation
        8. Time for action
        9. Summary
      17. 10. Integrating and Finalizing the Portfolio Management Application
        1. Integrating and structuring a portfolio application
          1. Step 1 – deactivating all the plugins used in this book
          2. Step 2 – creating a new standalone plugin
          3. Step 3 – moving all the plugins into wpwa-web-application
          4. Step 4 – removing plugin definitions
          5. Step 5 – creating common folders
          6. Step 6 – loading components to the main plugin
          7. Step 7 – creating the template loader
          8. Step 8 – reusing the autoloader
          9. Step 9 – defining main plugin functions
          10. Step 10 – building the template router
          11. Step 11 – building the activation controller
          12. Step 12 – building the script controller
          13. Step 13 – building the admin menu controller
          14. Step 14 – creating class initializations
          15. Step 15 – initializing application controllers
        2. Restructuring the custom post manager
        3. Integrating a template loader into the user manager
        4. Working with a restructured application
          1. Building the developer model
          2. Designing the developer list template
          3. Enabling AJAX-based filtering
        5. Updating a user profile with additional fields
          1. Updating values of profile fields
        6. Scheduling subscriber notifications
          1. Notifying subscribers through an e-mail
        7. Lesser-known WordPress features
          1. Caching
          2. Transients
          3. Testing
          4. Security
        8. Time for action
        9. Final thoughts
        10. Summary
      18. A. Configurations, Tools, and Resources
        1. Configure and set up WordPress
          1. Step 1 – downloading WordPress
          2. Step 2 – creating the application folder
          3. Step 3 – configuring the application URL
            1. Creating a virtual host
            2. Using a localhost
          4. Step 4 – installing WordPress
          5. Step 5 – setting up permalinks
          6. Step 6 – downloading the Responsive theme
          7. Step 7 – activating the Responsive theme
          8. Step 8 – activating the plugin
          9. Step 9 – using the application
        2. Open source libraries and plugins
        3. Online resources and tutorials
      19. Index