Slide 1

Slide 1 text

EXTEND WORDPRESS WITH CUSTOM CONTENT TYPES & CUSTOM FIELDS

Slide 2

Slide 2 text

WHAT IS A CUSTOM CONTENT TYPE? A custom post [content] type is nothing more than a regular post with a different post_type value in the database. The post type of regular posts is post, pages use page, attachments use attachment and so on. --Smashing Magazine (11/8/2012)

Slide 3

Slide 3 text

WHY USE CUSTOM CONTENT TYPES? ▪ Organization ▪ Prevent yourself from making hacky edits to display certain categories and/or pages in a certain manner, or hide certain posts from your blog feed ▪ Set up detailed templates to ensure that your end user creates content the way it’s supposed to look ▪ To make life better for your end user, client, intern, etc.

Slide 4

Slide 4 text

This is my Male Chimp, my sometime intern. WHO IS YOUR END USER?

Slide 5

Slide 5 text

#doingitwrong

Slide 6

Slide 6 text

#DOINGITWRONG

Slide 7

Slide 7 text

#DOINGITWRONG
Music Director
Student Ministries
Women in Ministry
Children's Ministries
Early Childhood
Contemporary Music
Organist
Curt is passionate about the clear preaching and teaching of God's Word and about leading God's people in spiritual growth and maturity, mission, outreach and community impact. For more than 27 years, he has served as a pastor or a founding pastor for churches in Alabama, Tennessee, Florida and western Pennsylvania. A native of Chesterfield County, VA, Curt has four earned degrees including a Doctor of Ministry (D.Min.) from Fuller Theological Seminary in Pasadena, CA and most recently a Doctor of Philosophy (Ph.D.) from Duquesne University in Pittsburgh, PA. He is the author of When I Need God the Most (Xulon Press, 2001) and co-author with his wife Karen of the three book series Life Brighteners (Waterbrook Press, 2004). He and Karen enjoy a marriage of over 29 years and have three children: Curtis III (a PCA pastor in Savannah, GA), Megan (a gifted soloist and customer support specialist with a leading cellular phone company) and Heather (a speech-language therapist). Curt enjoys gardening, golf, fishing, history, sports of all kinds (especially MLB) and Bichon Frise dogs.
Stu is proud to serve as New Hope's associate pastor, overseeing pastoral care and outreach ministries. Stu has served in Fort Myers since November of 2002 when he, Ethelanne, and their son Sean moved from Kansas City, Missouri. Stu and Ethelanne are graduates of Gordon-Conwell Theological Seminary and Stu also has an M.B.A. from the University of Texas at Arlington. He is a self confessed adrenalin junkie and has engaged in activities such as white water kayaking, serving as a Navy Chaplain with a Marine Artillery Battalion, sky diving, flying in an acrobatic bi-plane, and most recently, driving a NASCAR race car at the Richard Petty Driving experience. However, his most thrilling experience is seeing men and women identify their Kingdom roles and serve in their area of giftedness. Stu has a special burden for the HIV/AIDS pandemic in southern Africa.

Slide 8

Slide 8 text

#DOINGITWRONG ▪ It’s not easy enough for a Male Chimp. ▪ Everything is locked into one page. ▪ Each thumbnail has its own CSS. Truly. ▪ All images (thumbnails and larger images) are in the theme folder. ▪ The thumbnails are a double image made in Photoshop—one full opacity, one at 50%. ▪ I didn’t make a Custom Post Type or use the Loop.

Slide 9

Slide 9 text

WHAT WOULD MAKE THIS BETTER? ▪ Each staff person would be his own separate post, so easy for the Male Chimp to add/update/remove. ▪ I’d simplify the d@$# CSS. ▪ I’d let the Male Chimp upload images through the Media Uploader. ▪ The thumbnail and the larger image would be the same image. ▪ I’d create a Custom Post Type. And use the Loop.

Slide 10

Slide 10 text

#DOINGITBETTER

Slide 11

Slide 11 text

#DOINGITBETTER

Slide 12

Slide 12 text

#DOINGITBETTER All the Male Chimp has to enter is: 1. Name. 2. Content. 3. Featured Image.

Slide 13

Slide 13 text

USE CUSTOM CONTENT TYPES: ▪ Portfolio ▪ Products ▪ Testimonials ▪ People/Staff ▪ Events ▪ Galleries ▪ Slides/Sliders

Slide 14

Slide 14 text

A BASIC CPT add_action( 'init', 'codex_custom_init' ); function codex_custom_init() { $args = array( 'public' => true, 'label' => 'Books' ); register_post_type( 'book', $args ); } (http://codex.wordpress.org/Function_Reference/register_post_type#Example)

Slide 15

Slide 15 text

Ease v. longevity Theme v. Plugin

Slide 16

Slide 16 text

THEME OR PLUGIN? Build your Custom Post Type within a plugin for longer lasting freshness. Why use a plugin instead of a theme? 1. Troubleshooting 2. Editing 3. Future proofing 4. Reusable code 5. Not locking your user into one theme

Slide 17

Slide 17 text

A complex project can be simplified for the end user by setting up custom post meta for content types. Look for Patterns

Slide 18

Slide 18 text

ADD SOME CUSTOM FIELDS

Slide 19

Slide 19 text

USE CUSTOM FIELDS: ▪ Social media links (people) ▪ External URL (resources) ▪ Dates (events, sermons) ▪ MP3 (sermons, albums) ▪ Related Files ▪ Related Posts (or People, etc.) ▪ For anything that needs to always be within certain parameters

Slide 20

Slide 20 text

PUTTING IT ALL TOGETHER

Slide 21

Slide 21 text

PUTTING IT ALL TOGETHER

Slide 22

Slide 22 text

PUTTING IT ALL TOGETHER

Slide 23

Slide 23 text

RESOURCES ▪ http://codex.wordpress.org/Post_Types Custom Post Type Generator ▪ http://generatewp.com/post-type/ Custom Post Type Plugins ▪ https://wordpress.org/plugins/pods/ ▪ https://wordpress.org/plugins/custom-post-type-ui/

Slide 24

Slide 24 text

RESOURCES Custom Fields ▪ http://www.advancedcustomfields.com/ ▪ https://github.com/WebDevStudios/Custom-Metaboxes-and- Fields-for-WordPress/ ▪ https://wordpress.org/plugins/pods/

Slide 25

Slide 25 text

EXAMPLES Custom Metaboxes/Fields ▪ https://github.com/robincornett/simple-listings-genesis Custom Archive Page ▪ https://github.com/robincornett/simple-staff Boilerplate ▪ https://github.com/devinsays/portfolio-post-type ▪ https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate

Slide 26

Slide 26 text

RESOURCES Custom Roles/Access ▪ Members (Justin Tadlock) ▪ Access (wp-types)