KEMBAR78
Structured Data in WordPress | PPTX
Structured Data
in WordPress
Randy Hoyt
@randyhoyt                                       #wcto



About Me




              Randy Hoyt    randyhoyt.com
                            @randyhoyt


             Presentation   randyhoyt.com/wcto
@randyhoyt                                                   #wcto



 WordPress Timeline
       May 2003

       WordPress 0.7
       − Initial Release
       − Blog Posts




2003              2005     2007         2009         2011             2013




 WordPress Now Available
 http://wordpress.org/news/2003/05/wordpress-now-available/
@randyhoyt                                                  #wcto



 WordPress Timeline
              May 2004

              WordPress 1.2
              − Randy’s first WordPress blog




2003          2005                2007         2009   2011           2013
@randyhoyt                                                 #wcto



 WordPress Timeline
February 2005

 WordPress 1.5            “The „pages‟ feature allows you to run
 − Pages
 − Custom Fields
                          your entire site through WordPress.”




2003               2005     2007         2009        2011           2013




 Announcing WordPress 1.5
 http://wordpress.org/news/2005/02/strayhorn/
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt                                    #wcto



Structured Data
What is it?


         “Data that resides in fixed fields
         within a record.


       “ Contrast with unstructured data.”




PC Magazine Encyclopedia: Structured Data
http://r2h.me/pcmagdata
@randyhoyt                       #wcto



Structured Data
Structured        Unstructured
@randyhoyt                                                    #wcto



 WordPress Timeline
                                  June 2010

                                  WordPress 3.0
                                  − Custom Post Types




2003          2005        2007            2009          2011           2013




 WordPress 3.0 “Thelonious”
 http://wordpress.org/news/2010/06/thelonious/
@randyhoyt                   #wcto



Structured Data
Why use it?


1. Simple Adding / Editing
2. Complex Formatting
@randyhoyt   #wcto
@randyhoyt                    #wcto



Structured Data
Why use it?


1. Simple Adding / Updating
2. Complex Formatting
3. Data Integrity
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt                     #wcto



Structured Data
Why use it?


1. Ease of Adding & Updating
2. Complex Formatting
3. Data Integrity
4. Cross-Platform Delivery
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt                                                                #wcto




Adapting Ourselves to Adaptive Content
http://www.slideshare.net/KMcGrane/adapting-ourselves-to-adaptive-content-12133365
@randyhoyt                                                                #wcto




Adapting Ourselves to Adaptive Content
http://www.slideshare.net/KMcGrane/adapting-ourselves-to-adaptive-content-12133365
@randyhoyt   #wcto
@randyhoyt                                                                                #wcto



Theme vs. Plugin
 Where does this custom code belong?

“ 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.”



 Theme Functions File (functions.php)        Custom Functionality Plugin
 •   Code is executed just like a plugin     •   Completely separated from theme

 •   Activated (or deactivated) along with   •   Remains activated even theme is not
     the theme
                                             •   Best for code related to functionality
 •   Best for code related to appearance



How to create your own WordPress functionality plugin
http://wpcandy.com/teaches/how-to-create-a-functionality-plugin
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt                                           #wcto




WordPress Codex: Post Types > Custom Types
http://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                              wp_postmeta
 ID   post_type        post_title      post_id   meta_key     meta_value

 37   rrh_assignment   Final Project   37        date_due     12/07/2011

 38   rrh_assignment   Final Exam      37        percentage   24

                                       38        date_due     12/14/2011

                                       38        percentage   16
@randyhoyt      #wcto



Custom Fields
@randyhoyt                                                 #wcto



Custom Fields
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
@randyhoyt                                                      #wcto



Library: Custom Meta Boxes
http://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 Plugin
http://randyhoyt.com/wordpress/custom-meta-boxes-plugin/
@randyhoyt                                                 #wcto




Add Custom Meta Boxes to Your Plugin
http://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 Field
http://randyhoyt.com/wordpress/custom-post-type-ordering/
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt                                      #wcto




WordPress Codex: Template Hierarchy
http://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 Themes
http://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



Structured Data
Why use it?


1. Ease of Adding & Updating
2. Complex Formatting
3. Data Integrity
4. Cross-Platform Delivery
5. Logic-Based Automation
@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 Shortcodes
http://r2h.me/wpshortcodes
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt   #wcto
@randyhoyt                                          #wcto




CSV Importer
http://wordpress.org/extend/plugins/csv-importer/
Structured Data
in WordPress

Randy Hoyt     randyhoyt.com
               @randyhoyt


Presentation   randyhoyt.com/wcto
               #wcto

Structured Data in WordPress

  • 1.
  • 2.
    @randyhoyt #wcto About Me Randy Hoyt randyhoyt.com @randyhoyt Presentation randyhoyt.com/wcto
  • 3.
    @randyhoyt #wcto WordPress Timeline May 2003 WordPress 0.7 − Initial Release − Blog Posts 2003 2005 2007 2009 2011 2013 WordPress Now Available http://wordpress.org/news/2003/05/wordpress-now-available/
  • 4.
    @randyhoyt #wcto WordPress Timeline May 2004 WordPress 1.2 − Randy’s first WordPress blog 2003 2005 2007 2009 2011 2013
  • 5.
    @randyhoyt #wcto WordPress Timeline February 2005 WordPress 1.5 “The „pages‟ feature allows you to run − Pages − Custom Fields your entire site through WordPress.” 2003 2005 2007 2009 2011 2013 Announcing WordPress 1.5 http://wordpress.org/news/2005/02/strayhorn/
  • 6.
  • 7.
  • 8.
    @randyhoyt #wcto Structured Data What is it? “Data that resides in fixed fields within a record. “ Contrast with unstructured data.” PC Magazine Encyclopedia: Structured Data http://r2h.me/pcmagdata
  • 9.
    @randyhoyt #wcto Structured Data Structured Unstructured
  • 10.
    @randyhoyt #wcto WordPress Timeline June 2010 WordPress 3.0 − Custom Post Types 2003 2005 2007 2009 2011 2013 WordPress 3.0 “Thelonious” http://wordpress.org/news/2010/06/thelonious/
  • 11.
    @randyhoyt #wcto Structured Data Why use it? 1. Simple Adding / Editing 2. Complex Formatting
  • 12.
  • 13.
    @randyhoyt #wcto Structured Data Why use it? 1. Simple Adding / Updating 2. Complex Formatting 3. Data Integrity
  • 14.
  • 15.
  • 16.
    @randyhoyt #wcto Structured Data Why use it? 1. Ease of Adding & Updating 2. Complex Formatting 3. Data Integrity 4. Cross-Platform Delivery
  • 17.
  • 18.
  • 19.
    @randyhoyt #wcto Adapting Ourselves to Adaptive Content http://www.slideshare.net/KMcGrane/adapting-ourselves-to-adaptive-content-12133365
  • 20.
    @randyhoyt #wcto Adapting Ourselves to Adaptive Content http://www.slideshare.net/KMcGrane/adapting-ourselves-to-adaptive-content-12133365
  • 21.
  • 22.
    @randyhoyt #wcto Theme vs. Plugin Where does this custom code belong? “ 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.” Theme Functions File (functions.php) Custom Functionality Plugin • Code is executed just like a plugin • Completely separated from theme • Activated (or deactivated) along with • Remains activated even theme is not the theme • Best for code related to functionality • Best for code related to appearance How to create your own WordPress functionality plugin http://wpcandy.com/teaches/how-to-create-a-functionality-plugin
  • 23.
  • 24.
  • 25.
    @randyhoyt #wcto WordPress Codex: Post Types > Custom Types http://codex.wordpress.org/Post_Types#Custom_Types
  • 26.
  • 27.
    @randyhoyt #wcto Aptana, library uploaded, code for metaboxes
  • 28.
  • 29.
    @randyhoyt #wcto Custom Fields wp_posts wp_postmeta ID post_type post_title post_id meta_key meta_value 37 rrh_assignment Final Project 37 date_due 12/07/2011 38 rrh_assignment Final Exam 37 percentage 24 38 date_due 12/14/2011 38 percentage 16
  • 30.
    @randyhoyt #wcto Custom Fields
  • 31.
    @randyhoyt #wcto Custom Fields 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
  • 32.
    @randyhoyt #wcto Library: Custom Meta Boxes http://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.
  • 33.
  • 34.
    @randyhoyt #wcto Add Custom Meta Boxes to Your Plugin http://randyhoyt.com/wordpress/custom-meta-boxes-plugin/
  • 35.
    @randyhoyt #wcto Add Custom Meta Boxes to Your Plugin http://randyhoyt.com/wordpress/custom-meta-boxes-plugin/
  • 36.
  • 37.
  • 38.
    @randyhoyt #wcto Video, show fields, add values, save
  • 39.
    @randyhoyt #wcto Screenshot of dashboard, all assignments added Ordering WordPress Post Types By A Custom Field http://randyhoyt.com/wordpress/custom-post-type-ordering/
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
    @randyhoyt #wcto WordPress Codex: Template Hierarchy http://codex.wordpress.org/Template_Hierarchy
  • 47.
    @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 Themes http://codex.wordpress.org/Child_Themes
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
    @randyhoyt #wcto Structured Data Why use it? 1. Ease of Adding & Updating 2. Complex Formatting 3. Data Integrity 4. Cross-Platform Delivery 5. Logic-Based Automation
  • 60.
    @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 Shortcodes http://r2h.me/wpshortcodes
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
    @randyhoyt #wcto CSV Importer http://wordpress.org/extend/plugins/csv-importer/
  • 68.
    Structured Data in WordPress RandyHoyt randyhoyt.com @randyhoyt Presentation randyhoyt.com/wcto #wcto

Editor's Notes

  • #3 NEXT:WordPress 0.7
  • #4 NEXT:WordPress 1.2
  • #5 NEXT:WordPress 1.5
  • #6 NEXT: People Grid
  • #7 NEXT: Edit HTML on People Grid
  • #8 NEXT: Define Structured Data
  • #9 NEXT: Excel vs. Word
  • #10 NEXT: WordPress 3.0
  • #11 NEXT: Benefits 1-2
  • #12 NEXT: Edit Person screen
  • #13 NEXT: Benefits 3
  • #14 NEXT: Alexandria Mall directory
  • #15 NEXT: Alexandria Mall, Store Detail
  • #16 NEXT: Benefits 4
  • #17 NEXT: Alexandria Mall Mobile Site
  • #18 NEXT: Alexandria Mall Mobile App
  • #19 NEXT: Karen McGrane’s circles around content
  • #20 NEXT: Karen McGrane’s speech bubbles
  • #21 NEXT: EMAC 3361 Assignments page
  • #22 NEXT: Theme vs. Plugin
  • #23 NEXT: Create empty plugin
  • #24 NEXT: Add comments to header
  • #25 NEXT: Register post type
  • #26 NEXT: View custom plugin
  • #28 NEXT: Video 1
  • #30 NEXT: post type supports
  • #31 NEXT: custom field schema
  • #32 NEXT: custom field interface
  • #33 NEXT: Customizing the custom field interface
  • #34 NEXT: Custom meta boxes
  • #36 NEXT: Adding custom meta boxes to your plugin
  • #37 NEXT: Adding custom meta boxes to your plugin
  • #38 NEXT: Defining the custom meta box
  • #39 NEXT: Defining the custom meta box fields
  • #40 NEXT: List of two assignments (preparing for Video 2)
  • #41 NEXT: Video 2
  • #43 NEXT: Order by custom field
  • #45 NEXT: post type has_archive
  • #46 NEXT: Save Permalinks
  • #47 NEXT: menus
  • #48 NEXT: Drag menu item into place
  • #49 NEXT: Assignments archive page using archive.php
  • #50 NEXT: Template hierarchy
  • #51 NEXT: Child theme architecture
  • #52 NEXT: Child theme examples
  • #53 NEXT: style.css @import twentyeleven
  • #54 NEXT: copy archive.php to archive-rrh_assignment.php
  • #55 NEXT: Change title to Assignments
  • #56 NEXT: Add table header
  • #57 NEXT: Add table rows in loop
  • #58 NEXT: Add table footer
  • #59 NEXT: Activate child theme
  • #60 NEXT: View Assignments with assignment-rrh_archive.php
  • #61 NEXT: Upcoming Assignments separated out
  • #62 NEXT: Scroll down to past assignments
  • #63 NEXT: Benefit 5
  • #64 NEXT: Shortcodes
  • #65 NEXT: Widget with shortcode
  • #66 NEXT: Plugin file to add filters
  • #67 NEXT: Add filter and shortcode
  • #68 NEXT: Add args and query_posts
  • #69 NEXT: Add loop
  • #70 NEXT: Show list on home page
  • #71 NEXT: CSV importer
  • #72 NEXT: The End