Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Beyond Posts & Pages: Structured Content in WordPress

Beyond Posts & Pages: Structured Content in WordPress

How to take WordPress from blobs to chunks, creating structured content using custom post types, taxonomies, and metadata.

John Eckman

May 16, 2013
Tweet

More Decks by John Eckman

Other Decks in Technology

Transcript

  1. #CMSX #ChunkyWP @jeckman Beyond Posts & Pages: Structured Content in

    WordPress John Eckman ISITE Design | CMS Myth
  2. #CMSX #ChunkyWP @jeckman Shirts First five people to tweet: “Learning

    how to make WordPress Chunky with @jeckman at #cmsx #chunkyWP” 6
  3. #CMSX #ChunkyWP @jeckman Agenda •  Why do we need structured

    content? •  How does WordPress do it? –  Metadata –  Custom Post Types –  Custom Taxonomies •  Examples –  Basic: Slides, Alerts –  Complex: Stories •  Notes –  Search –  Controlling display –  Relationships 7
  4. #CMSX #ChunkyWP @jeckman Adaptive Content Five Key Elements of Adaptive

    Content: 1.  Reusable content –  Content developed to maximize reuse –  Different formats/types available 2.  Structured content –  Discrete chunks can be combined in different ways on different platforms 9 http://www.abookapart.com/products/content-strategy-for-mobile
  5. #CMSX #ChunkyWP @jeckman Adaptive Content, Cont’d 3.  Presentation-independent content – 

    Design decisions made by platform based on rules, not by authors 4.  Meaningful metadata –  Metadata which can be used by the platform to drive presentation rules 5.  Usable CMS interfaces –  UI and workflow to encourage well structured and metadata-enhanced content 10
  6. #CMSX #ChunkyWP @jeckman WordPress Chunks To enhance structured content in

    WordPress, we need more: •  Custom Post Types –  Not just “pages” and “posts” –  Complex content types •  Custom Taxonomies –  Sort, categorize, relate •  Custom Meta Data –  More boxes for granular data 13
  7. #CMSX #ChunkyWP @jeckman Code 17 Key is register_post_type Arguments passed

    control: •  What to call it (Labels) •  Where to show it –  Public, Show UI, Searchable, has_archive –  Menu position •  Who can use it (capabilities) •  What it includes (supports) http://codex.wordpress.org/Function_Reference/ register_post_type
  8. #CMSX #ChunkyWP @jeckman More Complex Example •  Client: Generation Citizen

    •  Custom Post Type for “Stories” •  Secondary HTML Areas •  Custom Taxonomies: Locations, Topics •  Custom Metadata •  Attachments 22
  9. #CMSX #ChunkyWP @jeckman Taxonomies Custom Post Types can be further

    enhanced with custom Taxonomies In this case that means: •  Register Taxonomy •  Show custom meta box •  Save on submit 26
  10. #CMSX #ChunkyWP @jeckman 27 Here we have a custom post

    type for “Stories” with two custom taxonomies: Locations and Topics
  11. #CMSX #ChunkyWP @jeckman 33 We’ve also got custom meta data

    here for: •  Pull Quote •  School •  Teacher •  Democracy Coaches
  12. #CMSX #ChunkyWP @jeckman Custom Meta Boxes •  Process for these

    other meta boxes is similar: –  add_meta_box() passed a styling function –  style function outputs the html needed –  save function added to save_post action –  update_post_meta to store 34
  13. #CMSX #ChunkyWP @jeckman Notes •  Search –  WordPress search does

    not search custom post meta data –  This means secondary html areas –  http://wordpress.org/extend/plugins/ relevanssi/ or other search •  Display –  You’ve customized the content so you can’t rely on <?php the_content() ?> 36
  14. #CMSX #ChunkyWP @jeckman Q & A •  Model content first

    •  Find the tradeoff –  More structure = more complexity –  Less structure = less flexibility •  Focus on goals – why before how •  Go forth and structure content! 38
  15. #CMSX #ChunkyWP @jeckman 39 Thank you. John Eckman ISITE Design

    | CMS Myth www.isitedesign.com www.cmsmyth.com @jeckman
  16. #CMSX #ChunkyWP @jeckman Resources •  Plugins –  http://wordpress.org/extend/plugins/ advanced-custom-fields/ – 

    http://wordpress.org/extend/plugins/ custom-content-type-manager/ –  http://wordpress.org/extend/plugins/ types/ (part of premium toolset) –  http://wordpress.org/extend/plugins/ custom-post-type-ui/ 40