wordpress custom post types

Post on 08-Apr-2017

228 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

WordPress CustomizationGoal: Gain a basic understanding of some common functions used by Clique from the WordPress PHP API, modifying the administrator user-interface, and present various data formats.

Outcomes:1. An understanding of what Post Types and Custom Fields are.2. Be able to identify when to use Custom Post Types and Custom Fields.3. Able to create and modify Custom Post Types and Custom Fields.

Custom Post TypesOutcomes:

1. Create two Custom Post Types using the WordPress API2. Modify an existing Custom Post Type3. Be able query and display post information within page templates4. Acknowledge when to use Custom Post Types in different situations

Custom FieldsOutcomes:

1. Create custom fields for different post types2. Gain an understanding of how to save, update, and delete custom post data3. Acknowledge when to use Custom Fields in different situations

Agenda1. Why we use various post types. 2. How do I use this in my work, best practices3. Client example, adding post type to Kendall College site. 4. Adding post type to your forked site

Understanding WhyWhy is it important to know how to create Custom Post Types and Fields - especially programmatically?

1. Present similar data in different ways2. Present different data in similar ways3. “Administrative Organization” - a well-organized user and programming

interface.

Why - Second City

● Large and complex website● Must present varying data types in

varying formats● Each “post” has multiple, varying

pieces of metadata attached to it● Data types required their own unique

categorization system

Why - Hampel & Co.

● Content isn’t updated regularly● Data has similar format, but needed

to be presented in different ways● Each “post” has a wide range of

varying metadata in different formats

Planning• Create Post Types

– Identify “groups” of data and information• What content blocks are similar?• What content blocks are different?

• Create Custom Fields– Identify data/information that should be attached to post as metadata

Best Practices/Example

Building• Required hooks

– add_action• init• save_post

• Create Post Types– register_post_type

• Create Custom Fields– add_meta_box

Best Practices/Example

Testing• Ensure post appears in back-end of WordPress

• Ensure data is being saved appropriately

• Loop through custom posts and fields on a page

Best Practices/Example

You do● Programmatically add 3 custom post

types to your own personal sites● Programmatically add 3 custom fields

to your own personal sites

ResourcesPost Type

● https://codex.wordpress.org/Post_Types● http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-

wordpress/Fields

● https://codex.wordpress.org/Custom_Fields● http://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-

and-hacks/

● https://generatewp.com/

top related