Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
WV305 WordPress Plugin Development
Session 1
Erick Hitter
cdia@ethitter.com
About Me
- Design Engineer at Automattic, the company behind WordPress.com.
- Formerly a WordPress developer at Oomph, Inc.
- Have been developing WordPress themes and plugins for 3+ years
- WordPress Core Contributor
- WordCamp Boston Organizer
- Boston WordPress Meetup Organizer
- Plugin Author
Tonight's Objectives
- Discuss module objectives, including final deliverable
- Install WordPress
- Review WordPress basics
- Discuss plugins
Module Description
Now that the benefits of content management systems are well understood and the foundational technologies of the web are beneath our belts, it's time to take the next step and learn how to customize WordPress to meet the varied needs of our clients. In this module we will explore the feature rich API’s available to developers, and demonstrate how they can be utilized to enhance and expand on the WordPress core code through plugin development.
Module Objectives
- WordPress Review: Picking up where we left off
- Hooking in to WordPress—Actions and Filters
- Starting your Plugin: Custom Administrative Menus & Pages
- Persistent Plugin Settings with the Options API
- Attaching Metadata to Posts: Custom Meta Boxes and the Post Meta Functions
- Extending WordPress as a CMS: Custom Post Types
-
Advanced Topics:
- Using classes to encapsulate your plugin functionality (namespacing)
- Widgets and Shortcodes
WP_Query
- Custom Taxonomy
Module Deliverable
Build a plugin that leverages WordPress' CMS-focused functionality to manage custom content of some sort
Examples:
- Portfolio management tool for creative professionals seeking to market their work
- Restaurant menu for small business owner
- Album management tool for a local band
- Product database for ecommerce retailer
- Featured partner manager for a site selling affiliate links
Module Deliverable
Guidelines
- Keep it simple—stay focused and do more with less
- Pick a topic that you are familiar with and passionate about
- While CSS/JavaScript enhancements are certainly play an important role in plugin development, try to focus on the PHP functionality rather than visual flairs or fancy behaviors
More specifics on this on Saturday. Until then, just think about what you'd like to build.
Installing WordPress
What we need:
- A copy of WordPress
- A webserver to run it
- A database server to hold its content
WordPress.org vs WordPress.com
The source of much confusion
.org |
.com |
Free to download |
Nothing to download |
Can install themes |
Cannot install themes, but many are provided for you |
Can install plugins |
Cannot install plugins |
Generally must pay to host it somewhere |
Free for basic capabilities, but upgrades are available |
Generally must pay for a domain name |
Must pay to use your own domain name, even if you already own it |
Let's Do This!
WordPress Review
Ask lots of questions now!
It's better to get everyone on the same page early
The Loop
- Arguably the most important part of WordPress, at least as far as end-users are concerned.
- Simplifies many aspects of interacting with the data on a site
- Writing its syntax will become second nature
The Loop
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
}
}
?>
The Loop: have_posts()
Serves two purposes:
- Tells your code whether any posts matched the query
- Enables PHP to loop through those posts
The Loop: the_post()
Sets up Template Tags, such as the_title()
and the_content()
Absolutely critical to The Loop. Omitting it has strange effects.
Template Tags
- Take data entered in the Visual Editor and display it to end-users.
- Always start with
the_
- Always echo their data, rather than return it.
- Can only be used in The Loop
- A partial list is at http://codex.wordpress.org/Template_Tags
Template Tags: Examples
the_title()
the_content()
the_excerpt()
the_permalink()
the_author()
Template Hierarchy
In other words, how does WordPress decide which template to use where?
- WordPress has a complex, but logical, way of determining which template should be used based on the page requested.
-
Two factors contribute to the decision:
- The query
- What templates exist in the theme
- On the Codex at http://codex.wordpress.org/Template_Hierarchy
Template Hierarchy: The Confusing Answer
Template Hierarchy: The Basic Answer
- What type of page is this?
Homepage, Post, Page, category archive, tag archive, and so on.
- Does a template for this type of page exist in the theme?
home.php
, single.php
, page.php
, category.php
, tag.php
- If not, use
index.php
.
How Is WordPress Organized?
Questions so far?