WordPress II - Extending WordPress (ITSEC 2109150) Meets Tues & Thur 6-9pm 2/17- 3/31
WordPress II - Extending WordPress
(ITSEC 2109150)
Meets Tues & Thur 6-9pm
2/17- 3/31
Course Objectives
• Understanding of WordPress extensibility.
• Familiarity in developing WordPress locally.
• Knowledge of the Core, the Loop, Hooks, etc.
• Experience customizing and building a child theme.
• Using Custom Post Types.
• Best practices strategies for WP development.
Course OutlineTopic Objectives and Details
Welcome & Introductions Introductions Syllabus & Policies
Your WordPress Dev Environment
Installing a Local Dev Instance of WordPress WordPress Core WordPress File Hierarchy WordPress Loop
Theme Customization Files and Templates Modifying an Existing Theme Child Themes Building Your Own Child Theme
Customization via Content Custom Post Types Taxonomies Taxonomy Table Structure Metadata
Plugin Development Data Validation Security Filter and Action Hooks Widgets Building Your Own Plugin
Monetizing Your Development Good User Experience Stats, Scalability, and Security Commercial Strategies
Optional Textbook
Professional WordPress: Design and Development, 2nd Ed.
• by Brad Williams, David Damstra, & Hal Stern
• Publisher: John Wiley & Sons, Inc. (www.wiley.com)
• ISBN: 978-1-118-44227-2
To the Calendar
remind.com
Who’s Your Host?
Working with WordPress Locally
• Runs on your local machine
• No remote server…no hosting required
• Common practice of developers
• Great for that late-night epiphany
Benefits of Developing Locally
• Privacy
• Isolation
• Independence
Typical Deployment Environment
DEVelopment
STAGE
PRODuction
Required “Server Components”
For Windows: WAMP
For Mac: MAMP
Break
The Core
• Part of the set of files original installed with WordPress.
• The "required" files of WordPress.
• Should change only when WordPress is upgraded to a newer version.
Files that are not "Core"
• plugins
• themes
• database settings
• any media files that have been added after initial install
WordPress Core Files
• primarily PHP
• also contain CSS, JavaScript, XML, HTML and image files.
• control how:
• content pages are rendered
• the configured theme and plugins are loaded
• options and settings are loaded
• and much more
Using Core as a Reference
• All core files (outside of images) can be viewed using a text editor.
• Most core files contain comments or "inline documentation".
• Uses the PHPDoc form of commenting.
Each Function Is Explained...
<?php /** * Sets up theme defaults and registers the various WordPress features that * Twenty Twelve supports. * * @uses load_theme_textdomain() For translation/localization support. * @uses add_editor_style() To add a Visual Editor stylesheet. * @uses add_theme_support() To add support for post thumbnails, automatic feed links, * custom background, and post formats. * @uses register_nav_menu() To add support for navigation menus. * @uses set_post_thumbnail_size() To set a custom post thumbnail size. * * @since Twenty Twelve 1.0 */ function twentytwelve_setup() {
Example taken from the functions.php file:
Template: <?php /** * Short Description * * Long Description * * @package WordPress * @since version * * @param type $varname Description * @return type $varname Description */
Break
Function Walkthrough
• Locate the file: wp-includes/capabilities.php
• Search for the function: is_super_admin()
• Even though it is written in PHP, see if you can follow the logic.
Key Core Files
• All of these are found in the /wp-includes directory:
• Functions.php
• Option.php
• Formatting.php
• Pluggable .php
• User.php
• Post.php
Deprecated Functions
• As WordPress evolves, and new versions are released, it is natural for some functions to become deprecated.
• For backward-compatibility, these functions are not removed outright from the core.
• Functions that are deprecated should not be used (called from) any plugin or theme that you develop.
• Most likely, there is a newer function that has replaced the deprecated function.
• See the file: /wp-includes/deprecated.php
Other Resources
• Codex: http://codex.wordpress.org
• Glossary: http://codex.wordpress.org/Glossary
• Lessons: http://codex.wordpress.org/Lessons
WordPress APIs
• API: Application Programmable Interface
• Help us interact with WordPress (as developers).
• API = A gateway into the WordPress codebase.
Most Common WP APIs• Plugin API - used for custom plugin development.
• Widgets API - used to create/maintain widgets in your custom plugin.
• Shortcode API - used to add shortcodes to your custom plugin.
• Settings API - used for creating a settings page.
• Others: HTTP API, Options API, Rewrite API
• See WordPress_API's in the Codex
Again the Core is for Reference Only
• Viewing the core files for reference and learning is certainly encouraged.
• Editing the core files is verboten!
• Alternatives???