SlideShare a Scribd company logo
1 of 23
Download to read offline
ADVANCINGYOUR CUSTOM FIELDS
Troy Chaplin	

WordCamp Ottawa 2014
WHAT ARE CUSTOM FIELDS
• Meta data fields that store arbitrary information	

• Meta data is handled with key and value pairs	

• Same key can be used multiple times on same post	

• Advanced functionality include dates for post expiration, or yes / no
values to show or hide elements on a post
ENHANCING CUSTOM FIELDS
• Core custom field interface is not user friendly or intuitive	

• Confusing to non technical users	

• Not immediately apparent what they are used for	

• Require users to know exact key naming convention	

• Don’t fit into a seamless workflow
ADVANCED CUSTOM FIELDS
• Powerful plugin to create groups of custom
fields	

• Over 20 field types	

• Easy integration for developer	

• Intuitive custom field interfaces for content
editors	

• Free and Premium add-ons for additional
functionality	

• Conditional logic	

• Set fields to be required to ensure data input
GETTING STARTED
• Similar feel to creating a post — uses a
custom post type	

• Title area to easily identify groups in a
larger list	

• Specify where groups will be used (posts,
pages, custom post types, categories,
taxonomies, templates, parents, and more)	

• Options to set order of appearance,
position, style	

• Simple way to hide other default items
BASIC FIELDS
• Text: open ended field that accepts
anything the user wishes to use	

• Text Area: basic paragraph editor (this
one has a character limit applied)	

• Number: accepts only numerical values	

• Email & Password: open ended field
that accepts any form of text
BUILDING BASIC FIELDS
Getting the meta data
<?php the_field(‘field_name'); ?>	

$textName = get_field(‘field_name');	

Example
<article>	

	

 <h1><?php the_field('text'); ?></h1>	

	

 <p><?php the_field('text_area'); ?></p>	

	

 <ul>	

	

 	

 <li><?php the_field('number'); ?></li>	

	

 	

 <li><?php the_field('email'); ?></li>	

	

 	

 <li><?php the_field('password'); ?></li>	

	

 </ul>	

</article>
CONTENT FIELDS
• Text Area with WYSIWYG: full
content editor with full or basic tool
options and media uploader	

• Image and File: upload and attach
images or files	

• Image and files can be configured to
return values of object, URL or ID
BUILDING CONTENT FIELDS
<article>	

	

 <?php the_field('text_area'); ?>	

	

 <img src="<?php the_field(‘image’); ?>"/>	

	

 <p><a href="<?php the_field('file'); ?>">Download File</a></p>	

</article>	

Images by ID
$image = get_field('image');	

$size = 'full'; // (thumbnail, medium, large, full or custom size)	

<?php wp_get_attachment_image( $image, $size ); ?>
BUILDING CONTENT FIELDS
Images by Post Object
<?php 	

	

 $image = get_field('image');	

	

 if( !empty($image) ): 	

	

 $url = $image['url'];	

 	

 $alt = $image['alt'];	

 	

 	

 $size = 'thumbnail';	

	

 $title = $image['title'];	

 	

 $caption = $image['caption'];	

 	

 $thumb = $image['sizes'][ $size ];	

?>	

	

 <?php if( $caption ): ?>	

	

 	

 <div class=“wp-caption">	

	

 <?php endif; ?>	

	

 	

 <img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" />	

	

 <?php if( $caption ): ?>	

	

 	

 	

 <p class="wp-caption-text"><?php echo $caption; ?></p>	

	

 	

 </div> // Closes wp-caption div	

	

 <?php endif; ?>	

<?php endif; ?>
CHOICE FIELDS
• Select: a drop down list of options for
user to select	

• Checkbox: a series of options where
users can select one or more items	

• Radio: a series of options where users
can select only one item at a time	

• True / False: a statement that users can
select to be true
BUILDING CHOICE FIELDS
Select or Checkbox Fields - Single Value
<?php the_field('field_name'); ?>	

Select or Checkbox Fields - Multiple Values
<?php echo implode(', ', get_field('field_name')); ?>	

True / False
if( get_field('field_name') ) {	

echo "do something";	

} else {	

echo "do something else";	

}
RELATION FIELDS
• Page Link: a drop down list of pages,
posts or custom post types, limited to
retrieving URL	

• Post Object: same as page link, can
also retrieve URL, title and meta data	

• Relationship: share data between
multiple posts through relationships	

• Taxonomy: a list of categories, tags or
taxonomies to select	

• User: a drop down list of core roles
BUILDING RELATION FIELDS
Page Link
<a href="<?php the_field('page_link'); ?>">Read this!</a>	

Post Object (Single)
<?php	

	

 $post_object = get_field('post_object');	

	

 if( $post_object ): 	

	

 	

 $post = $post_object;	

	

 	

 setup_postdata( $post ); 	

?>	

	

 <div>	

	

 	

 <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>	

	

 	

 <span>Post Object Custom Field: <?php the_field('field_name'); ?></span>	

	

 </div>	

	

 <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>	

<?php endif; ?>
BUILDING RELATION FIELDS
Basic loop (with setup_postdata)
<?php	

	

 $posts = get_field(‘relationship_field_name');	

	

 if( $posts ): 	

?>	

	

 <ul>	

	

 <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>	

	

 	

 <?php setup_postdata($post); ?>	

	

 	

 <li>	

	

 	

 	

 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>	

	

 	

 	

 <span>Custom field from $post: <?php the_field('author'); ?></span>	

	

 	

 </li>	

	

 <?php endforeach; ?>	

	

 </ul>	

	

 <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>	

<?php endif; ?>
OTHER FIELDS
• Tabs: group fields inside tabs	

• Google Maps: an interactive map with the
ability to search an address and place a
marker	

• Date Picker: a jQuery date selection pop up	

• Color Picker: a jQuery color selection pop
up	

• Messages: a place for you to provide
additional instructions or notes that not have
an user input
ADD-ONS
Premium
• Flexible Content
Field	

• Gallery Field	

• Repeater Field	

• Options Page
Freebies
• PayPal Field	

• Text Limiter	

• WordPress
WYSIWYG	

• Gravity Forms Field	

• Date andTime Picker	

• Contact Form 7 Field	

• Taxonomy Field
– Steve Jobs
“Simple can be harder than complex:You have to
work hard to get your thinking clean to make it simple.
But it’s worth it in the end because once you get
there, you can move mountains.”
THANKS FOR COMING OUT!	

ANY QUESTIONS?
@troychaplin	

troychaplin.ca

More Related Content

What's hot

Parsing strange v3
Parsing strange v3Parsing strange v3
Parsing strange v3Hal Stern
 
Drupal 8 templating with twig
Drupal 8 templating with twigDrupal 8 templating with twig
Drupal 8 templating with twigTaras Omelianenko
 
Avoiding Pitfalls with Internationalization & Localization
Avoiding Pitfalls with Internationalization & LocalizationAvoiding Pitfalls with Internationalization & Localization
Avoiding Pitfalls with Internationalization & LocalizationLogan Gauthier
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to themingBrahampal Singh
 
8 things to know about theming in drupal 8
8 things to know about theming in drupal 88 things to know about theming in drupal 8
8 things to know about theming in drupal 8Logan Farr
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Curtiss Grymala
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeAdam Darowski
 
6 global library function provided by open cart
6 global library function provided by open cart6 global library function provided by open cart
6 global library function provided by open cartSelf
 
Wordpress theme development
Wordpress theme developmentWordpress theme development
Wordpress theme developmentNaeem Junejo
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep diveRomain Jarraud
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESSjsmith92
 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) ThemingPINGV
 
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Laura Scott
 
One-hour Drupal 8 Theming
One-hour Drupal 8 ThemingOne-hour Drupal 8 Theming
One-hour Drupal 8 ThemingMediacurrent
 
Drupal 8: Theming
Drupal 8: ThemingDrupal 8: Theming
Drupal 8: Themingdrubb
 

What's hot (20)

Parsing strange v3
Parsing strange v3Parsing strange v3
Parsing strange v3
 
Drupal 8 templating with twig
Drupal 8 templating with twigDrupal 8 templating with twig
Drupal 8 templating with twig
 
Avoiding Pitfalls with Internationalization & Localization
Avoiding Pitfalls with Internationalization & LocalizationAvoiding Pitfalls with Internationalization & Localization
Avoiding Pitfalls with Internationalization & Localization
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to theming
 
Html and Xhtml
Html and XhtmlHtml and Xhtml
Html and Xhtml
 
8 things to know about theming in drupal 8
8 things to know about theming in drupal 88 things to know about theming in drupal 8
8 things to know about theming in drupal 8
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress Theme
 
6 global library function provided by open cart
6 global library function provided by open cart6 global library function provided by open cart
6 global library function provided by open cart
 
Wordpress theme development
Wordpress theme developmentWordpress theme development
Wordpress theme development
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep dive
 
Xhtml 2010
Xhtml 2010Xhtml 2010
Xhtml 2010
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
WEB DEVELOPMENT
WEB DEVELOPMENTWEB DEVELOPMENT
WEB DEVELOPMENT
 
Css
CssCss
Css
 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) Theming
 
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
One-hour Drupal 8 Theming
One-hour Drupal 8 ThemingOne-hour Drupal 8 Theming
One-hour Drupal 8 Theming
 
Drupal 8: Theming
Drupal 8: ThemingDrupal 8: Theming
Drupal 8: Theming
 

Viewers also liked

Rahul organizing
Rahul organizingRahul organizing
Rahul organizingrkjn90
 
HR Answers-HR 101
HR Answers-HR 101HR Answers-HR 101
HR Answers-HR 101Steve Lovig
 
Aspire Systems_CoE_Cloud Service Offerings
Aspire Systems_CoE_Cloud Service OfferingsAspire Systems_CoE_Cloud Service Offerings
Aspire Systems_CoE_Cloud Service OfferingsRamani R
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsBarry Feldman
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome EconomyHelge Tennø
 

Viewers also liked (8)

Rahul organizing
Rahul organizingRahul organizing
Rahul organizing
 
Albumsitiolandia
AlbumsitiolandiaAlbumsitiolandia
Albumsitiolandia
 
Writing for the Web
Writing for the WebWriting for the Web
Writing for the Web
 
IT Communications and Rockstars
IT Communications and RockstarsIT Communications and Rockstars
IT Communications and Rockstars
 
HR Answers-HR 101
HR Answers-HR 101HR Answers-HR 101
HR Answers-HR 101
 
Aspire Systems_CoE_Cloud Service Offerings
Aspire Systems_CoE_Cloud Service OfferingsAspire Systems_CoE_Cloud Service Offerings
Aspire Systems_CoE_Cloud Service Offerings
 
The Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post FormatsThe Six Highest Performing B2B Blog Post Formats
The Six Highest Performing B2B Blog Post Formats
 
The Outcome Economy
The Outcome EconomyThe Outcome Economy
The Outcome Economy
 

Similar to ADVANCING CUSTOM FIELDS WITH ADVANCED CUSTOM FIELDS PLUGIN

The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017Amanda Giles
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
Introduction to Advanced Custom Fields
Introduction to Advanced Custom FieldsIntroduction to Advanced Custom Fields
Introduction to Advanced Custom FieldsZero Point Development
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012Stephanie Leary
 
Grok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateGrok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateLaura Scott
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyLeslie Doherty
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Dutyreedmaniac
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...LinnAlexandra
 
Word press templates
Word press templatesWord press templates
Word press templatesDan Phiffer
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Adam Tomat
 
Parsing strange v2
Parsing strange v2Parsing strange v2
Parsing strange v2Hal Stern
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018Adam Tomat
 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPressNile Flores
 
Carrington Core (2014)
Carrington Core (2014)Carrington Core (2014)
Carrington Core (2014)alexkingorg
 
Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Adam Tomat
 

Similar to ADVANCING CUSTOM FIELDS WITH ADVANCED CUSTOM FIELDS PLUGIN (20)

The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
Introduction to Advanced Custom Fields
Introduction to Advanced Custom FieldsIntroduction to Advanced Custom Fields
Introduction to Advanced Custom Fields
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012
 
Grok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateGrok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb update
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Refactoring
RefactoringRefactoring
Refactoring
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 
Word press templates
Word press templatesWord press templates
Word press templates
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018
 
Parsing strange v2
Parsing strange v2Parsing strange v2
Parsing strange v2
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018
 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPress
 
Carrington Core (2014)
Carrington Core (2014)Carrington Core (2014)
Carrington Core (2014)
 
Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019Supercharging WordPress Development - Wordcamp Brighton 2019
Supercharging WordPress Development - Wordcamp Brighton 2019
 
Phphacku iitd
Phphacku iitdPhphacku iitd
Phphacku iitd
 

Recently uploaded

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
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
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
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
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Recently uploaded (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
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!
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
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
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
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
 
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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

ADVANCING CUSTOM FIELDS WITH ADVANCED CUSTOM FIELDS PLUGIN

  • 1. ADVANCINGYOUR CUSTOM FIELDS Troy Chaplin WordCamp Ottawa 2014
  • 2. WHAT ARE CUSTOM FIELDS • Meta data fields that store arbitrary information • Meta data is handled with key and value pairs • Same key can be used multiple times on same post • Advanced functionality include dates for post expiration, or yes / no values to show or hide elements on a post
  • 3. ENHANCING CUSTOM FIELDS • Core custom field interface is not user friendly or intuitive • Confusing to non technical users • Not immediately apparent what they are used for • Require users to know exact key naming convention • Don’t fit into a seamless workflow
  • 4. ADVANCED CUSTOM FIELDS • Powerful plugin to create groups of custom fields • Over 20 field types • Easy integration for developer • Intuitive custom field interfaces for content editors • Free and Premium add-ons for additional functionality • Conditional logic • Set fields to be required to ensure data input
  • 5. GETTING STARTED • Similar feel to creating a post — uses a custom post type • Title area to easily identify groups in a larger list • Specify where groups will be used (posts, pages, custom post types, categories, taxonomies, templates, parents, and more) • Options to set order of appearance, position, style • Simple way to hide other default items
  • 6. BASIC FIELDS • Text: open ended field that accepts anything the user wishes to use • Text Area: basic paragraph editor (this one has a character limit applied) • Number: accepts only numerical values • Email & Password: open ended field that accepts any form of text
  • 7. BUILDING BASIC FIELDS Getting the meta data <?php the_field(‘field_name'); ?> $textName = get_field(‘field_name'); Example <article> <h1><?php the_field('text'); ?></h1> <p><?php the_field('text_area'); ?></p> <ul> <li><?php the_field('number'); ?></li> <li><?php the_field('email'); ?></li> <li><?php the_field('password'); ?></li> </ul> </article>
  • 8. CONTENT FIELDS • Text Area with WYSIWYG: full content editor with full or basic tool options and media uploader • Image and File: upload and attach images or files • Image and files can be configured to return values of object, URL or ID
  • 9. BUILDING CONTENT FIELDS <article> <?php the_field('text_area'); ?> <img src="<?php the_field(‘image’); ?>"/> <p><a href="<?php the_field('file'); ?>">Download File</a></p> </article> Images by ID $image = get_field('image'); $size = 'full'; // (thumbnail, medium, large, full or custom size) <?php wp_get_attachment_image( $image, $size ); ?>
  • 10. BUILDING CONTENT FIELDS Images by Post Object <?php $image = get_field('image'); if( !empty($image) ): $url = $image['url']; $alt = $image['alt']; $size = 'thumbnail'; $title = $image['title']; $caption = $image['caption']; $thumb = $image['sizes'][ $size ]; ?> <?php if( $caption ): ?> <div class=“wp-caption"> <?php endif; ?> <img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" /> <?php if( $caption ): ?> <p class="wp-caption-text"><?php echo $caption; ?></p> </div> // Closes wp-caption div <?php endif; ?> <?php endif; ?>
  • 11. CHOICE FIELDS • Select: a drop down list of options for user to select • Checkbox: a series of options where users can select one or more items • Radio: a series of options where users can select only one item at a time • True / False: a statement that users can select to be true
  • 12. BUILDING CHOICE FIELDS Select or Checkbox Fields - Single Value <?php the_field('field_name'); ?> Select or Checkbox Fields - Multiple Values <?php echo implode(', ', get_field('field_name')); ?> True / False if( get_field('field_name') ) { echo "do something"; } else { echo "do something else"; }
  • 13. RELATION FIELDS • Page Link: a drop down list of pages, posts or custom post types, limited to retrieving URL • Post Object: same as page link, can also retrieve URL, title and meta data • Relationship: share data between multiple posts through relationships • Taxonomy: a list of categories, tags or taxonomies to select • User: a drop down list of core roles
  • 14. BUILDING RELATION FIELDS Page Link <a href="<?php the_field('page_link'); ?>">Read this!</a> Post Object (Single) <?php $post_object = get_field('post_object'); if( $post_object ): $post = $post_object; setup_postdata( $post ); ?> <div> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <span>Post Object Custom Field: <?php the_field('field_name'); ?></span> </div> <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> <?php endif; ?>
  • 15. BUILDING RELATION FIELDS Basic loop (with setup_postdata) <?php $posts = get_field(‘relationship_field_name'); if( $posts ): ?> <ul> <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?> <?php setup_postdata($post); ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span>Custom field from $post: <?php the_field('author'); ?></span> </li> <?php endforeach; ?> </ul> <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> <?php endif; ?>
  • 16. OTHER FIELDS • Tabs: group fields inside tabs • Google Maps: an interactive map with the ability to search an address and place a marker • Date Picker: a jQuery date selection pop up • Color Picker: a jQuery color selection pop up • Messages: a place for you to provide additional instructions or notes that not have an user input
  • 17. ADD-ONS Premium • Flexible Content Field • Gallery Field • Repeater Field • Options Page Freebies • PayPal Field • Text Limiter • WordPress WYSIWYG • Gravity Forms Field • Date andTime Picker • Contact Form 7 Field • Taxonomy Field
  • 18. – Steve Jobs “Simple can be harder than complex:You have to work hard to get your thinking clean to make it simple. But it’s worth it in the end because once you get there, you can move mountains.”
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. THANKS FOR COMING OUT! ANY QUESTIONS? @troychaplin troychaplin.ca