Structured Data in WordPress

Post on 13-May-2015

4.484 views 4 download

description

Not just for blogging anymore, WordPress is an effective platform for powering websites with a variety of types of content: product catalogs, store locations, employee directories, and more. Using advanced WordPress features like custom post types, store this content as structured data to make it easier to maintain and better suited to live in new contexts like mobile applications. Learn about these structured data features, custom plugin and theme development, and mobile device optimization.

Transcript of Structured Data in WordPress

Structured Datain WordPressRandy Hoyt

@randyhoyt #wcto

Randy Hoyt randyhoyt.com

@randyhoyt

Presentation randyhoyt.com/wcto

About Me

@randyhoyt #wcto

WordPress Timeline

May 2003

WordPress Now Availablehttp://wordpress.org/news/2003/05/wordpress-now-available/

− Initial Release− Blog Posts

WordPress 0.7

2003 2005 2007 2009 2011 2013

@randyhoyt #wcto

WordPress Timeline

May 2004

− Randy’s first WordPress blog

WordPress 1.2

2003 2005 2007 2009 2011 2013

@randyhoyt #wcto

WordPress Timeline

Announcing WordPress 1.5http://wordpress.org/news/2005/02/strayhorn/

February 2005

− Pages− Custom Fields

WordPress 1.5

2003 2005 2007 2009 2011 2013

“The ‘pages’ feature allows you

to run your entire site through

WordPress.”

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

“Data that resides in fixed

fields within a record.

Contrast with unstructured

data.”

Structured Data

PC Magazine Encyclopedia: Structured Datahttp://r2h.me/pcmagdata

What is it?

@randyhoyt #wcto

Structured DataStructured Unstructured

@randyhoyt #wcto

WordPress Timeline

WordPress 3.0 “Thelonious”http://wordpress.org/news/2010/06/thelonious/

June 2010

− Custom Post Types

WordPress 3.0

2003 2005 2007 2009 2011 2013

@randyhoyt #wcto

1. Simple Adding / Editing

2. Complex Formatting

Structured DataWhy use it?

@randyhoyt #wcto

@randyhoyt #wcto

1. Simple Adding / Updating

2. Complex Formatting

3. Data Integrity

Structured DataWhy use it?

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

1. Ease of Adding & Updating

2. Complex Formatting

3. Data Integrity

4. Cross-Platform Delivery

Structured DataWhy use it?

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

Adapting Ourselves to Adaptive Contenthttp://www.slideshare.net/KMcGrane/adapting-ourselves-to-adaptive-content-12133365

@randyhoyt #wcto

Adapting Ourselves to Adaptive Contenthttp://www.slideshare.net/KMcGrane/adapting-ourselves-to-adaptive-content-12133365

@randyhoyt #wcto

@randyhoyt #wcto

Theme vs. Plugin

Custom Functionality Plugin

• Completely separated from theme

• Remains activated even theme is not

• Best for code related to functionality

Theme Functions File

(functions.php)

• Code is executed just like a plugin

• Activated (or deactivated) along with

the theme

• Best for code related to appearance

Where does this custom code belong?

How to create your own WordPress functionality pluginhttp://wpcandy.com/teaches/how-to-create-a-functionality-plugin

A common, yet unfortunate practice in the

WordPress community involves filling theme

functions.php files with tweaks and functionality

that is key to a site.”

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

WordPress Codex: Post Types > Custom Typeshttp://codex.wordpress.org/Post_Types#Custom_Types

@randyhoyt #wcto

@randyhoyt #wcto

Aptana, library uploaded, code for metaboxes

@randyhoyt #wcto

@randyhoyt #wcto

Custom Fields

wp_posts

ID post_type post_title

37 rrh_assignment Final Project

38 rrh_assignment Final Exam

wp_postmeta

post_id meta_key meta_value

37 date_due 12/07/2011

37 percentage 24

38 date_due 12/14/2011

38 percentage 16

@randyhoyt #wcto

Custom Fields

@randyhoyt #wcto

Three Ways to Customize the Interface

Tutorial: “Reusable Custom Meta Boxes”

http://r2h.me/wpreuseable

Plugin: Advanced Custom Fields

http://wordpress.org/extend/plugins/advanced-

custom-fields/

Library: Custom Meta Boxes

http://r2h.me/wpcmb

Custom Fields

@randyhoyt #wcto

Library: Custom Meta Boxeshttp://r2h.me/wpcmb

Custom Meta Boxes allow you to build clean,

understandable interfaces for entering metadata. There’s

a ton of field options: text, textarea, checkbox, dropdown

list, WYSIWYG, and more.

@randyhoyt #wcto

@randyhoyt #wcto

Add Custom Meta Boxes to Your Pluginhttp://randyhoyt.com/wordpress/custom-meta-boxes-plugin/

@randyhoyt #wcto

Add Custom Meta Boxes to Your Pluginhttp://randyhoyt.com/wordpress/custom-meta-boxes-plugin/

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

Video, show fields, add values, save

@randyhoyt #wcto

Screenshot of dashboard, all assignments added

Ordering WordPress Post Types By A Custom Fieldhttp://randyhoyt.com/wordpress/custom-post-type-ordering/

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

WordPress Codex: Template Hierarchyhttp://codex.wordpress.org/Template_Hierarchy

@randyhoyt #wcto

Child Theme Architecture

A WordPress child theme is a theme that

inherits the functionality of another theme,

called the parent theme, and allows you to

modify or add functionality.

Making a child theme is very simple. Create a

directory, put a properly formatted style.css

file in it, and you have a child theme!

WordPress Codex: Child Themeshttp://codex.wordpress.org/Child_Themes

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

1. Ease of Adding & Updating

2. Complex Formatting

3. Data Integrity

4. Cross-Platform Delivery

5. Logic-Based Automation

Structured DataWhy use it?

@randyhoyt #wcto

Shortcodes

When a shortcode is inserted in WordPress, it

is replaced with appropriate dynamic content

produced by a PHP function.

Let’s say we want to show the most recent

posts in a given post. We could use something

like this:

[recent-posts]

Smashing Magazine: WordPress Shortcodeshttp://r2h.me/wpshortcodes

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

@randyhoyt #wcto

CSV Importerhttp://wordpress.org/extend/plugins/csv-importer/

Randy Hoyt randyhoyt.com

@randyhoyt

Presentation randyhoyt.com/wcto

#wcto

Structured Datain WordPress