SlideShare una empresa de Scribd logo
1 de 31
Custom Post Types & Taxonomies WordPress just got CMSier
Who Am I? I am a self-taught designer and programmer with over 5 years of experience working with a variety of businesses, non-profits, and individuals. While I specialize in WordPress themes and CMS development, I also do all levels of Web Design and XHTML/CSS coding. I freelance some through my personal brand, Tammy Hart Designs while also working a full time gig at blr | further as a UI Developer.       TammyHartDesigns.com      tammy@tammyhartdesigns.com      @tammyhart
What is a Post Type? Posts and pages and more! Oh my!
How Do They Work? Should be called “Content Types” Content goes into the posts table Each content item is assigned a post_type The queries output the content  The default post type is ‘post’
Built in Types Main Content Post – blog style content Page – static content Other Attachment – any images or other files uploaded to a post (of any type) Revision – an archive of versions of a particular post Nav Menu Item – Used in the new menu system
Custom Types Employees Products … any content that needs to be stored and used differently than blog posts or static pages Won’t show up in main RSS feed
What Isn’t a Post Type? Asides and galleries and links! Oh my!
Post Formats Coming in WordPress 3.1 Think Tumblr, not post types More like post’s post types, not different content types Will show up in main RSS feed
More Information Post Formats - WordPress.org Codexhttp://bit.ly/formats01 Post Formats vs. Custom Post Types – Mark Jaquithhttp://bit.ly/formats02 What, Whys, and How To’sof Post Formats in WordPress 3.1 – WP Beginnerhttp://bit.ly/formats03 Post types and formats and taxonomies, oh my! - Ottohttp://bit.ly/formats04
What Is a taxonomy? Read my lips, now new taxonomies
How Do They Work? Terms and their unique ID’s are saved in the terms table Terms are assigned a taxonomy in the term_taxonomy table Terms are related to posts (of all types) in the term_relationships table
Built in Taxonomies Post Taxonomies Category Post Tag Other Link Category Nav Menu
Custom Taxonomies Employee departments Product categories … any way you want to tag or categorize your custom post types Can be used with blog posts and static pages as well Multiple taxonomy query coming in WordPress 3.1 Use Query Multiple Taxonomies plugin
Hand Coding The hard way
Register a Post Type function post_type_movies(){ 	register_post_type('movies', 		array('label'=> __('Movies'),  			'public'=>true,  			'show_ui'=>true, 'supports' =>array( 'post-thumbnails', 				'excerpts', 				'trackbacks', 				'custom-fields', 				'comments', 				'revisions') ) ); 	register_taxonomy_for_object_type('post_tag', 'movies'); } add_action('init', 'post_type_movies'); First Impressions of Custom Post Type by Frank Bültge on WPEngineer.org http://bit.ly/posttypes
Default Arguments // Args prefixed with an underscore are reserved for internal use. $defaults =array( 'label' =>false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' =>false, '_edit_link' =>'post.php?post=%d', 'capability_type'=>'post', 'hierarchical' => false, 'public' => false, 'rewrite' =>true, 'query_var' =>true, 'supports' =>array(), 'register_meta_box_cb' => null, 'taxonomies' =>array(), 'show_ui' => null ); First Impressions of Custom Post Type by Frank Bültge on WPEngineer.org http://bit.ly/posttypes
The Taxonomy Code function post_type_movies(){ … register_taxonomy('actor', 'movies',  array( 'hierarchical'=>true,  'label'=> __('Actor') )  );  register_taxonomy(‘director', 'movies', array( 			'hierarchical'=>false, 'label'=>__(‘Director'), 'query_var'=>‘director', 'rewrite' =>array('slug'=>‘director') 		) 	); } add_action('init', 'post_type_movies'); First Impressions of Custom Post Type by Frank Bültge on WPEngineer.org http://bit.ly/posttypes
Using Plugins The easy way
“ Overheard WordCamp Birmingham 2009 WordPress is the iPhone of the internet. You’ll always hear, “There’s a plugin for that!”
Plugins for Creating Them Custom Post Type UI Creates both TONS of labeling options WP Post Type UI Creates both Buggy Allows a custom icon More Types & More Taxonomies Allows you to override built in types and taxonomies Allows a custom icon Works seamlessly with the More Fields plugin (stay tuned for more)
Plugins for Manipulating Them Custom Post Type Order Drag and drop ordering Simple Custom Post Type Archives Adds support for custom post type archive permalinks Adds new body classes to custom post type archives Adds a new conditional, is_custom_post_type_archive Fixes the wp_title output on custom post type archives to show the custom type's label Adds custom post type feeds And more… Post Type Switcher Change the post type one item at a time Convert Post Types Bulk edit post types
Custom Templates Now what do I do?
Template Hierarchy Custom Post Type single-{post_type}.php single.php index.php Custom Post Types Display Coming in version 3.1 Use Simple Custom Post Type Archives plugin Custom Taxonomy taxonomy-{taxonomy}-{term}.php taxonomy-{taxonomy}.php taxonomy.php archive.php index.php
Custom Loops & Queries This gets hardcore
The Loop The Basic Loop <? $loop =newWP_query('post_type=movies'); while ($loop->have_posts()): $loop->the_post(); ?> ... Do Stuff Here ... <?endwhile; ?> Add Custom Taxonomies $loop =newWP_query('post_type=movies&actor=joaquin-phoenix'); $loop =newWP_query('post_type=movies&actor=joaquin-phoenix&director=m-night-shyamalan');
Term Lists Get All Terms $terms =get_terms('actors', 'order_by=count&order=DESC'); Get Terms in a Post get_the_term_list( $post->ID, 'actors', '<p>Actors: ', ',', '</p>' ) Other Functions get_term get_term_children get_term_by get_taxonomies
More Custom Content But wait, there’s more!
“ Matt Mullenweg WordCamp Birmingham 2009 I like what you’re doing; I just don’t like the way you’re having to do it. So I’m going to make it better.
No More Flutter Custom Post Types to create the special content Custom Taxonomies to organize the content Custom Fields to get specific information on each post in a way that is human and pretty
Customized Custom Fields Plugins More Fields Builds pretty boxes with custom types of custom fields Works perfectly with More Types and More Taxonomies Custom fields Widget-like interface Doesn’t seem to interact with custom post types Easy Custom Fields Just as much coding as the hand coded method … not so easy Hand Coded add_meta_box() Basically limitless Lots o’ code WordPress.org Codexhttp://bit.ly/metabox01 Tutorial at Deluxe Blog Tipshttp://bit.ly/metabox02 We Function Tutorialhttp://bit.ly/metabox03
Thanks! Questions? TammyHartDesigns.comtammy@tammyhartdesigns.com@tammyhart

Más contenido relacionado

Destacado

Workshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learnedWorkshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learnedBas van Dishoeck
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealJoey Kudish
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginMainak Goswami
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeJulie Kuehl
 
WordPress Code Architecture
WordPress Code ArchitectureWordPress Code Architecture
WordPress Code ArchitectureMario Peshev
 
Beginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentBeginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentAizat Faiz
 
WordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress OptimizationWordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress OptimizationJoost de Valk
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialChristos Zigkolis
 

Destacado (9)

Workshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learnedWorkshop 4: IJssel-Vechtdelta lessons learned
Workshop 4: IJssel-Vechtdelta lessons learned
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
 
Anatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress ThemeAnatomy and Architecture of a WordPress Theme
Anatomy and Architecture of a WordPress Theme
 
Architecture for WordPress on AWS
Architecture for WordPress on AWSArchitecture for WordPress on AWS
Architecture for WordPress on AWS
 
WordPress Code Architecture
WordPress Code ArchitectureWordPress Code Architecture
WordPress Code Architecture
 
Beginning WordPress Plugin Development
Beginning WordPress Plugin DevelopmentBeginning WordPress Plugin Development
Beginning WordPress Plugin Development
 
WordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress OptimizationWordCamp Ireland - 40 tips for WordPress Optimization
WordCamp Ireland - 40 tips for WordPress Optimization
 
Wordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short TutorialWordpress Plugin Development Short Tutorial
Wordpress Plugin Development Short Tutorial
 

Similar a CPT & Taxonomies: Custom Content Types in WordPress

Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Evan Mullins
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme developmentTammy Hart
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post TypesNile Flores
 
Using Custom Post Types and Advanced Custom Fields with Elementor
 Using Custom Post Types and Advanced Custom Fields with Elementor Using Custom Post Types and Advanced Custom Fields with Elementor
Using Custom Post Types and Advanced Custom Fields with ElementorAngela Bowman
 
Custom content types &amp; custom taxonomies in wordpress
Custom content types &amp; custom taxonomies in wordpressCustom content types &amp; custom taxonomies in wordpress
Custom content types &amp; custom taxonomies in wordpressstimasoft
 
The Flexibility of WordPress
The Flexibility of WordPressThe Flexibility of WordPress
The Flexibility of WordPressStephanie Eckles
 
Stepping Into Custom Post Types
Stepping Into Custom Post TypesStepping Into Custom Post Types
Stepping Into Custom Post TypesK.Adam White
 
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015Joe Querin
 
Week 7 introduction to theme development
Week 7   introduction to theme developmentWeek 7   introduction to theme development
Week 7 introduction to theme developmenthenri_makembe
 
The very introduction to content management systems
The very introduction to content management systemsThe very introduction to content management systems
The very introduction to content management systemsSean Donnelly BA MSc QFA
 
Wordpress template hierarchy
Wordpress template hierarchyWordpress template hierarchy
Wordpress template hierarchyStockton Group
 
WordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenWordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenHeidi Cool
 
advance theme development
advance theme developmentadvance theme development
advance theme development1amitgupta
 
WordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - ThemesWordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - ThemesMetronet
 
Every Artist needs a Great Website: Getting Started with WordPress
Every Artist needs a Great Website: Getting Started with WordPressEvery Artist needs a Great Website: Getting Started with WordPress
Every Artist needs a Great Website: Getting Started with WordPressRuth Maude
 
Workshop: Creating your first WordPress plugin
Workshop: Creating your first WordPress pluginWorkshop: Creating your first WordPress plugin
Workshop: Creating your first WordPress pluginylefebvre
 
WordPress 3: Leveraging the Shiny New Features
WordPress 3: Leveraging the Shiny New FeaturesWordPress 3: Leveraging the Shiny New Features
WordPress 3: Leveraging the Shiny New FeaturesReggie Nicolay
 
Kulpreet Singh's Tazzu WordCamp Presentation
Kulpreet Singh's Tazzu WordCamp PresentationKulpreet Singh's Tazzu WordCamp Presentation
Kulpreet Singh's Tazzu WordCamp Presentationguest4a8eb4
 

Similar a CPT & Taxonomies: Custom Content Types in WordPress (20)

Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post Types
 
Using Custom Post Types and Advanced Custom Fields with Elementor
 Using Custom Post Types and Advanced Custom Fields with Elementor Using Custom Post Types and Advanced Custom Fields with Elementor
Using Custom Post Types and Advanced Custom Fields with Elementor
 
Custom content types &amp; custom taxonomies in wordpress
Custom content types &amp; custom taxonomies in wordpressCustom content types &amp; custom taxonomies in wordpress
Custom content types &amp; custom taxonomies in wordpress
 
The Flexibility of WordPress
The Flexibility of WordPressThe Flexibility of WordPress
The Flexibility of WordPress
 
Stepping Into Custom Post Types
Stepping Into Custom Post TypesStepping Into Custom Post Types
Stepping Into Custom Post Types
 
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
 
Week 7 introduction to theme development
Week 7   introduction to theme developmentWeek 7   introduction to theme development
Week 7 introduction to theme development
 
The very introduction to content management systems
The very introduction to content management systemsThe very introduction to content management systems
The very introduction to content management systems
 
Wordpress template hierarchy
Wordpress template hierarchyWordpress template hierarchy
Wordpress template hierarchy
 
WordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenWordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-Between
 
WordPress 3.1 Preview
WordPress 3.1 PreviewWordPress 3.1 Preview
WordPress 3.1 Preview
 
advance theme development
advance theme developmentadvance theme development
advance theme development
 
WordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - ThemesWordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - Themes
 
Every Artist needs a Great Website: Getting Started with WordPress
Every Artist needs a Great Website: Getting Started with WordPressEvery Artist needs a Great Website: Getting Started with WordPress
Every Artist needs a Great Website: Getting Started with WordPress
 
Workshop: Creating your first WordPress plugin
Workshop: Creating your first WordPress pluginWorkshop: Creating your first WordPress plugin
Workshop: Creating your first WordPress plugin
 
Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)
 
WordPress 3: Leveraging the Shiny New Features
WordPress 3: Leveraging the Shiny New FeaturesWordPress 3: Leveraging the Shiny New Features
WordPress 3: Leveraging the Shiny New Features
 
Kulpreet Singh's Tazzu WordCamp Presentation
Kulpreet Singh's Tazzu WordCamp PresentationKulpreet Singh's Tazzu WordCamp Presentation
Kulpreet Singh's Tazzu WordCamp Presentation
 

Más de Tammy Hart

Traversing Search Results
Traversing Search ResultsTraversing Search Results
Traversing Search ResultsTammy Hart
 
WordPress Transients
WordPress TransientsWordPress Transients
WordPress TransientsTammy Hart
 
In Browser Design with WordPress
In Browser Design with WordPressIn Browser Design with WordPress
In Browser Design with WordPressTammy Hart
 
Responsify! 5 Things You Should Know About Responsive Web Design
Responsify! 5 Things You Should Know About Responsive Web DesignResponsify! 5 Things You Should Know About Responsive Web Design
Responsify! 5 Things You Should Know About Responsive Web DesignTammy Hart
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentTammy Hart
 
Food Blog Design
Food Blog DesignFood Blog Design
Food Blog DesignTammy Hart
 
Dont Forget the Milk
Dont Forget the MilkDont Forget the Milk
Dont Forget the MilkTammy Hart
 
Designing for WordPress
Designing for WordPressDesigning for WordPress
Designing for WordPressTammy Hart
 
Freelancing with WordPress
Freelancing with WordPressFreelancing with WordPress
Freelancing with WordPressTammy Hart
 
Professioanl Blogging
Professioanl BloggingProfessioanl Blogging
Professioanl BloggingTammy Hart
 
Word Press & Working With Clients
Word Press & Working With ClientsWord Press & Working With Clients
Word Press & Working With ClientsTammy Hart
 
Word Press And Multimedia
Word Press And MultimediaWord Press And Multimedia
Word Press And MultimediaTammy Hart
 

Más de Tammy Hart (13)

Traversing Search Results
Traversing Search ResultsTraversing Search Results
Traversing Search Results
 
WordPress Transients
WordPress TransientsWordPress Transients
WordPress Transients
 
In Browser Design with WordPress
In Browser Design with WordPressIn Browser Design with WordPress
In Browser Design with WordPress
 
Responsify! 5 Things You Should Know About Responsive Web Design
Responsify! 5 Things You Should Know About Responsive Web DesignResponsify! 5 Things You Should Know About Responsive Web Design
Responsify! 5 Things You Should Know About Responsive Web Design
 
Responsify!
Responsify!Responsify!
Responsify!
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
 
Food Blog Design
Food Blog DesignFood Blog Design
Food Blog Design
 
Dont Forget the Milk
Dont Forget the MilkDont Forget the Milk
Dont Forget the Milk
 
Designing for WordPress
Designing for WordPressDesigning for WordPress
Designing for WordPress
 
Freelancing with WordPress
Freelancing with WordPressFreelancing with WordPress
Freelancing with WordPress
 
Professioanl Blogging
Professioanl BloggingProfessioanl Blogging
Professioanl Blogging
 
Word Press & Working With Clients
Word Press & Working With ClientsWord Press & Working With Clients
Word Press & Working With Clients
 
Word Press And Multimedia
Word Press And MultimediaWord Press And Multimedia
Word Press And Multimedia
 

Último

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Último (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

CPT & Taxonomies: Custom Content Types in WordPress

  • 1. Custom Post Types & Taxonomies WordPress just got CMSier
  • 2. Who Am I? I am a self-taught designer and programmer with over 5 years of experience working with a variety of businesses, non-profits, and individuals. While I specialize in WordPress themes and CMS development, I also do all levels of Web Design and XHTML/CSS coding. I freelance some through my personal brand, Tammy Hart Designs while also working a full time gig at blr | further as a UI Developer. TammyHartDesigns.com tammy@tammyhartdesigns.com @tammyhart
  • 3. What is a Post Type? Posts and pages and more! Oh my!
  • 4. How Do They Work? Should be called “Content Types” Content goes into the posts table Each content item is assigned a post_type The queries output the content The default post type is ‘post’
  • 5. Built in Types Main Content Post – blog style content Page – static content Other Attachment – any images or other files uploaded to a post (of any type) Revision – an archive of versions of a particular post Nav Menu Item – Used in the new menu system
  • 6. Custom Types Employees Products … any content that needs to be stored and used differently than blog posts or static pages Won’t show up in main RSS feed
  • 7. What Isn’t a Post Type? Asides and galleries and links! Oh my!
  • 8. Post Formats Coming in WordPress 3.1 Think Tumblr, not post types More like post’s post types, not different content types Will show up in main RSS feed
  • 9. More Information Post Formats - WordPress.org Codexhttp://bit.ly/formats01 Post Formats vs. Custom Post Types – Mark Jaquithhttp://bit.ly/formats02 What, Whys, and How To’sof Post Formats in WordPress 3.1 – WP Beginnerhttp://bit.ly/formats03 Post types and formats and taxonomies, oh my! - Ottohttp://bit.ly/formats04
  • 10. What Is a taxonomy? Read my lips, now new taxonomies
  • 11. How Do They Work? Terms and their unique ID’s are saved in the terms table Terms are assigned a taxonomy in the term_taxonomy table Terms are related to posts (of all types) in the term_relationships table
  • 12. Built in Taxonomies Post Taxonomies Category Post Tag Other Link Category Nav Menu
  • 13. Custom Taxonomies Employee departments Product categories … any way you want to tag or categorize your custom post types Can be used with blog posts and static pages as well Multiple taxonomy query coming in WordPress 3.1 Use Query Multiple Taxonomies plugin
  • 14. Hand Coding The hard way
  • 15. Register a Post Type function post_type_movies(){ register_post_type('movies', array('label'=> __('Movies'), 'public'=>true, 'show_ui'=>true, 'supports' =>array( 'post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') ) ); register_taxonomy_for_object_type('post_tag', 'movies'); } add_action('init', 'post_type_movies'); First Impressions of Custom Post Type by Frank Bültge on WPEngineer.org http://bit.ly/posttypes
  • 16. Default Arguments // Args prefixed with an underscore are reserved for internal use. $defaults =array( 'label' =>false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' =>false, '_edit_link' =>'post.php?post=%d', 'capability_type'=>'post', 'hierarchical' => false, 'public' => false, 'rewrite' =>true, 'query_var' =>true, 'supports' =>array(), 'register_meta_box_cb' => null, 'taxonomies' =>array(), 'show_ui' => null ); First Impressions of Custom Post Type by Frank Bültge on WPEngineer.org http://bit.ly/posttypes
  • 17. The Taxonomy Code function post_type_movies(){ … register_taxonomy('actor', 'movies', array( 'hierarchical'=>true, 'label'=> __('Actor') ) ); register_taxonomy(‘director', 'movies', array( 'hierarchical'=>false, 'label'=>__(‘Director'), 'query_var'=>‘director', 'rewrite' =>array('slug'=>‘director') ) ); } add_action('init', 'post_type_movies'); First Impressions of Custom Post Type by Frank Bültge on WPEngineer.org http://bit.ly/posttypes
  • 18. Using Plugins The easy way
  • 19. “ Overheard WordCamp Birmingham 2009 WordPress is the iPhone of the internet. You’ll always hear, “There’s a plugin for that!”
  • 20. Plugins for Creating Them Custom Post Type UI Creates both TONS of labeling options WP Post Type UI Creates both Buggy Allows a custom icon More Types & More Taxonomies Allows you to override built in types and taxonomies Allows a custom icon Works seamlessly with the More Fields plugin (stay tuned for more)
  • 21. Plugins for Manipulating Them Custom Post Type Order Drag and drop ordering Simple Custom Post Type Archives Adds support for custom post type archive permalinks Adds new body classes to custom post type archives Adds a new conditional, is_custom_post_type_archive Fixes the wp_title output on custom post type archives to show the custom type's label Adds custom post type feeds And more… Post Type Switcher Change the post type one item at a time Convert Post Types Bulk edit post types
  • 22. Custom Templates Now what do I do?
  • 23. Template Hierarchy Custom Post Type single-{post_type}.php single.php index.php Custom Post Types Display Coming in version 3.1 Use Simple Custom Post Type Archives plugin Custom Taxonomy taxonomy-{taxonomy}-{term}.php taxonomy-{taxonomy}.php taxonomy.php archive.php index.php
  • 24. Custom Loops & Queries This gets hardcore
  • 25. The Loop The Basic Loop <? $loop =newWP_query('post_type=movies'); while ($loop->have_posts()): $loop->the_post(); ?> ... Do Stuff Here ... <?endwhile; ?> Add Custom Taxonomies $loop =newWP_query('post_type=movies&actor=joaquin-phoenix'); $loop =newWP_query('post_type=movies&actor=joaquin-phoenix&director=m-night-shyamalan');
  • 26. Term Lists Get All Terms $terms =get_terms('actors', 'order_by=count&order=DESC'); Get Terms in a Post get_the_term_list( $post->ID, 'actors', '<p>Actors: ', ',', '</p>' ) Other Functions get_term get_term_children get_term_by get_taxonomies
  • 27. More Custom Content But wait, there’s more!
  • 28. “ Matt Mullenweg WordCamp Birmingham 2009 I like what you’re doing; I just don’t like the way you’re having to do it. So I’m going to make it better.
  • 29. No More Flutter Custom Post Types to create the special content Custom Taxonomies to organize the content Custom Fields to get specific information on each post in a way that is human and pretty
  • 30. Customized Custom Fields Plugins More Fields Builds pretty boxes with custom types of custom fields Works perfectly with More Types and More Taxonomies Custom fields Widget-like interface Doesn’t seem to interact with custom post types Easy Custom Fields Just as much coding as the hand coded method … not so easy Hand Coded add_meta_box() Basically limitless Lots o’ code WordPress.org Codexhttp://bit.ly/metabox01 Tutorial at Deluxe Blog Tipshttp://bit.ly/metabox02 We Function Tutorialhttp://bit.ly/metabox03