17
Structuring Content in WordPress USING ADVANCED CUSTOM FIELDS

Structuring Content in WordPress using Advanced Custom Fields

Embed Size (px)

DESCRIPTION

Slides from my talk on Advanced Custom Fields & structuring content in WordPress, from WordCamp Milwaukee, 2014

Citation preview

Page 1: Structuring Content in WordPress using Advanced Custom Fields

Structuring Content in WordPressUSING ADVANCED CUSTOM FIELDS

Page 2: Structuring Content in WordPress using Advanced Custom Fields

Hello!I’m Jamie Schmid.

EX-ILLUSTRATOR, WORDPRESS ENTHUSIAST, INFORMATION ARCHITECT

FREELANCE, CORPORATE & IN-BETWEEN

MILWAUKEE / PORTLAND, OR

@JAMIESCHMID

Page 3: Structuring Content in WordPress using Advanced Custom Fields

How do Custom Fields work?

Key/value pairs

“Key” – “name” – a constant that identifies a specific field Stays the same for all posts, cannot be duplicated

Can be called multiple times on one page

Value – info displayed for each field when you call it Can change with each post

Can be globally accessed also

Page 4: Structuring Content in WordPress using Advanced Custom Fields

Where are Custom Fields used?

Yoast SEO fields

Genesis framework: different visual layouts to select from

Themify: color boxes to select different color themes

Page 5: Structuring Content in WordPress using Advanced Custom Fields

Why Custom Fields?

Structuring content is more important than ever

Take site out of WYSIWYG box Chunks vs blobs: break content into manageable blocks

Serve together on one page, or divide & send to mobile, api, anywhere else

COPE: Create once, publish everywhere

Good experience for content publishers

Page 6: Structuring Content in WordPress using Advanced Custom Fields

Why Advanced Custom Fields?o Core custom fields interface is

confusing, not user friendly

o Interrupts workflow

o Lots of work to customize and limit

http://www.advancedcustomfields.com/

Page 7: Structuring Content in WordPress using Advanced Custom Fields

Installation:Advanced Custom Fields is “Freemium”

Free Version

Text / textarea

Wysiwyg

Image

File

Page link

Post object

Relationship

Select

Checkbox

radio buttons

Color / date picker

true / false

Pro

Personal (single site) :$25 (can upgrade)

Developer (unlimited forever): $100

Features:

Repeater

Flex Content

Gallery

Options Panel

These are indispensable.

Page 8: Structuring Content in WordPress using Advanced Custom Fields

ACF - Available Fields

Basic Fields

Text / Text Area

Number

Email

Password

Date/Color picker

Content

WYSIWYG full or ltd

Image

File

Choice

Select

Radio Button

Checkbox

True/False

Relational

Page Link

Post Object

Relationship

Taxonomy

User

jQuery

Google Map

Date Picker

Color Picker

Layout

Message

Tab

Flex Content *

Repeater *

Gallery *

Options *

* Pro only

Page 9: Structuring Content in WordPress using Advanced Custom Fields

Fields Demo!

Page 10: Structuring Content in WordPress using Advanced Custom Fields

Conditional Statements

In Your Theme: Best practice to display CF’s with

a conditional

Can display certain support elements only if field exists

Add class to body

Display alternate data

Only display posts with a specific custom field

In the Admin: Setting expiration date for posts

Page-specific content types

Extended publish statuses

Page 11: Structuring Content in WordPress using Advanced Custom Fields

Conditionals Demo!

Page 12: Structuring Content in WordPress using Advanced Custom Fields

Admin UX

Hide unused page elements

Field & Metabox naming conventions

Logical grouping of related fields

Tabs

Page placement – top, main, sidebar

Conditionals for showing different inputs

Input Validation

Notes/directions

Page 13: Structuring Content in WordPress using Advanced Custom Fields

Admin UX Demo!

Page 14: Structuring Content in WordPress using Advanced Custom Fields

Content ModelingA process to describe all your types of data and the relationships between them

Audit EVERYTHING

Wireframe every pageSeriously, every page.

You will probably find:

There are more pages than you thought

Maybe even whole sections

Navigation issues

Layout limitations

Plan your custom fields & relationships right on the page, including id’s

Use standard naming conventions

Use language the user will understand

Identify unique blocks

That require special tags

Special output

Shared content across the site

Page 15: Structuring Content in WordPress using Advanced Custom Fields

But be realistic.

Draw a balance between strictly structured content, and freedom for the author to enter all the content they need

We don’t want to make the author bend their content to fit your structure

No model survives first contact with real content.

Page 16: Structuring Content in WordPress using Advanced Custom Fields

Potential Issues

ACF Plugin must be installed for metadata fields to show Can export as PHP for mu_plugins

wp_search: only searches the_content() – no custom fields Search WP & Faceted Search plugins

rss: only feeds the_content()

Localization plugins: only translates the_content() (typically)

ACF text output is not escaped like native WordPress functions https://github.com/10up/secured-advanced-custom-fields

http://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data

Page 17: Structuring Content in WordPress using Advanced Custom Fields

Questions / Examples?

Thanks :)

Jamie Schmid

@jamieschmid