Custom Post Typesand TaxonomiesTakis BouyourisWeb Developer @ NevmaWordPress Greek CommunityWorkshop @ TEI ThessalyLarissa – Sat. 11/07/2015
View Slide
Nice to meet youMy name is Takis Bouyourisweb developer @ Nevma
My goal todayHelp you understand whatcustom post types andtaxonomies are andmotivate you to use them
What is WordPress?
WordPressA blog engine, a CMS,or an application platform?
Well, it's all of the above!But how did this come to be?Some history...
Oh, nooo, not history!
WordPress v.1 - 2004
WordPress v.2 – 2005/6
WordPress v.2.5 - 2008
WordPress v.3.0 - 2010
WordPress v.4.0 - 2014
WordPress evolutionnot just design-wise
WordPress has evolvedinto a full featured CMSand an application platform
Since v.3 WordPress supportsCustom post typesCustom taxonomies
Custom post types are likeposts and pagesCustom taxonomies are likecategories and tags
So, we 've got posts, pages,categories and tags and...more posts,more pages,more categoriesand more tags?
That all?
No!What you have is an extensibledata structure functionality.
Extensible data structures!
Extensible data structuresthat are simple and accessible!
Custom post typesCreate a new area of special pagesand name it what you like/need
Custom taxonomiesCreate a new ways to categorisethe post types you manage
Example 1a video clubCustom post type => movieCustom taxonomies =>category, studio, country
Example 2a house brokerCustom post type => houseCustom taxonomies =>house type, area, usage
Example 3corporate website common patternsPages => corporate infoPosts => news/blog
Example 3 (cont'd)Custom post type => projectsCustom taxonomies =>project category, project area
Example 3 (cont'd)Pages =>Home pageProfileProductsContactetc
Example 3 (cont'd)Posts (news) =>Our new website onlineSummer sales this weekLatest productsFiscal report 2015etc
Example 3 (cont'd)Custom Post Type Projects =>Sportswear eshopInsurance company websiteCorporate websiteetc
Example 3 (cont'd)Custom TaxonomiesProject category =>website, eshop, design, etcProject area =>Athens, Larissa, Veroia, etc
Let's make acustom post typefrom scratch
OMG, he's gonna show code now!
OK, that was code!
The important bitsnametaxonomieshierarchicalcapability
Let's make acustom taxonomyfrom scratch
OMG somebody stop him!
Yeap, that was code again!
The important bitsnamepost_typeshierarchical
Relax!There are tools to generatethis code"Generate WP"http://generatewp.com
There are plugins with a UI"GD Custom Post Types andTaxonomies Tools"https://wordpress.org/plugins/gd-taxonomies-tools/
So, not so bad after all...
Custom post types and taxonomiesare great, but we also needthe templates to show themMeet the "template hierarchy"https://developer.wordpress.org/themes/basics/template-hierarchy/
"Template hierarchy"The WordPress way to define whichPHP template will be chosen tohandle each user request.Necessary for theming.
Template hierarchy
Let's zoom in a bit
Theme PHP files
Check it out interactively withhttp://wphierarchy.com/
To sum upCustom post types are extensibledata structures (the WordPress way)and custom taxonomies are new waysto categorise them
WordPress Greek CommunityFacebookhttps://facebook.com/groups/WordPressGreekCommunity/Twitterhttps://twitter.com/wordpressgrcomm/Websitehttp://www.wpgc.gr/http://www.wpgreece.org/
Thank you for listening!
Questions?
Takis Bouyouris, Nevma[email protected]https://www.facebook.com/takis.bouyourishttps://www.linkedin.com/in/takisbouyourisSorry and thank you SNL :-)