SlideShare a Scribd company logo
1 of 19
Download to read offline
Advanced custom fields
Advanced Custom Fields plugin acts as a GUI layer for
custom fields.
Here is the difference between native custom fields and Advanced Custom Fields.
It provides a much friendlier user interface to edit content.
Advanced custom fields
Flexible Content
This allows users to enter an unlimited amount of layouts
including repeating content with control over the order.
ACF VERSIONS
There is a free version, personal and PRO version of advanced custom fields.
The personal version($20) is for one website, the PRO version is for unlimited sites.
Plugin advanced custom fields PRO ($100).
● Plugin lets you create custom fields, as well as repeaters, flexible content, gallery,
etc.
● We’re going to talk about defining your own webpage content layout using flexible
content. http://www.advancedcustomfields.com/
● Can create layouts that will allow users to enter just about any kind of content like
text, video, galleries, maps and layouts.
Goal
Create homepage template where the user can enter content into a variety of layouts.
Demo with the following content layouts:
● Hero with a background image and
optional CTA button (uses conditional
logic)
● Content with 1, 2 or 3 columns
● Content with 2 columns, one text, one
image
● Image with caption
● Gallery
● FAQ’s (repeater)
Once plugin is installed, we will:
● Create field group of type
flexible content
● We can assign content to
appear on a page, post or
CPT, so when we edit our
homepage, the layout will
appear
● Can import/export code
● Can show or hide items
Here is a list of all the possible
field types we can use.
Let’s start creating our layouts.
This shows the Hero layout:
● Add new layout called Hero
● Add 5 fields
○ Hero image
○ Hero text
○ Display CTA button(this
is a conditional field so
user can turn this off or
on)
○ Hero button URL
○ Hero button text
There are 5 more layouts that we’
ve created.
Let’s look at how this looks in the admin.
Conditional Logic
true/false
Display button conditionally
Conditional logic to show or hide button
CTA button.
Select field type for number of columns. Conditional logic to show or hide column 3.
1-3 Column layout (Services)
FAQ’s using repeater field type.
Sub Fields for question and answer.
USER ENTERS CONTENT
User can:
● Create layouts with desired
content
● Drag to reorder any of the
content
CREATE TEMPLATE FILES IN THEME TO DISPLAY CONTENT
What’s being used in theme:
● Theme with Bootstrap
● ACF plugin
● Flickity slider to display gallery
Layout/File Structure
Each ACF layout corresponds to a specific template
I’m creating a template file for each layout type
Theme fileshome-page.phpHomepage layout
Main template file: home-
template.php
Check if we have rows
If we have layout call:
get_template_part()
So if we have a hero layout
call /partials/stripe-hero.php
stripe-hero.php
This is the template file that will
display our hero content
We use get_sub_field()
to get the field values.
Create HTML structure for our
layout.
Set background image
Display field values
Can use the_sub_field()
to display fields.
Note: In template files, we can use ACF functionality to display fields, or use WP function get_post_meta.
Using get_post_meta will work even if plugin is removed or deactivated.
$rows = get_post_meta( get_the_ID(), 'home_page_content', true );
if( !empty( $rows) ) {
foreach( $rows as $count => $row ) {
if ($row == 'hero') {
// HERO
$rows = get_post_meta( get_the_ID(), 'home_page_content', true );
if( !empty( $rows) ) {
foreach( $rows as $count => $row ) {
$hero_image = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_image', true );
$image_src = wp_get_attachment_image_src( $hero_image, 'full');
if ($hero_image) {
$bg = wp_get_attachment_image( $image, 'large' );
}
$content = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_text', true );
$display_cta_button = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_display_cta_button', true );
if ($display_cta_button) {
$hero_button_url = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_button_url', true );
$hero_button_text = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_button_text', true );
echo '<p class="cta"><a class="button" href="' . $hero_button_url . '">' . $hero_button_text . '</a></p>';
}
}
}
}
elseif ($row == ‘services’) {
// SERVICES
…
}
}
}
Let’s edit and display our content
RESOURCES
● http://www.advancedcustomfields.com/
● http://www.advancedcustomfields.com/resources/flexible-content/
● Good documentation and example code on ACF website
● Videos show how to create layout similar to my demo
● Google search will take you to some good posts on how to create layouts
Norm Euker - http://www.njedesign.com
Demo: http://njedesign.com/demo/acf/

More Related Content

What's hot

How to Create simple One Page site
How to Create simple One Page siteHow to Create simple One Page site
How to Create simple One Page siteMoneer kamal
 
Oop php 5
Oop php 5Oop php 5
Oop php 5phpubl
 
WordCamp Bristol 2019 - WordPress custom theme building
WordCamp Bristol 2019 - WordPress custom theme buildingWordCamp Bristol 2019 - WordPress custom theme building
WordCamp Bristol 2019 - WordPress custom theme buildingJonny Allbut
 
Custom post-framworks
Custom post-framworksCustom post-framworks
Custom post-framworksKiera Howe
 
Rails view chapte 5 - form
Rails view   chapte 5 - formRails view   chapte 5 - form
Rails view chapte 5 - formThaichor Seng
 
Drupal Lightning FAPI Jumpstart
Drupal Lightning FAPI JumpstartDrupal Lightning FAPI Jumpstart
Drupal Lightning FAPI Jumpstartguestfd47e4c7
 

What's hot (8)

Wp meetup custom post types
Wp meetup custom post typesWp meetup custom post types
Wp meetup custom post types
 
How to Create simple One Page site
How to Create simple One Page siteHow to Create simple One Page site
How to Create simple One Page site
 
Oop php 5
Oop php 5Oop php 5
Oop php 5
 
Theming Volto
Theming VoltoTheming Volto
Theming Volto
 
WordCamp Bristol 2019 - WordPress custom theme building
WordCamp Bristol 2019 - WordPress custom theme buildingWordCamp Bristol 2019 - WordPress custom theme building
WordCamp Bristol 2019 - WordPress custom theme building
 
Custom post-framworks
Custom post-framworksCustom post-framworks
Custom post-framworks
 
Rails view chapte 5 - form
Rails view   chapte 5 - formRails view   chapte 5 - form
Rails view chapte 5 - form
 
Drupal Lightning FAPI Jumpstart
Drupal Lightning FAPI JumpstartDrupal Lightning FAPI Jumpstart
Drupal Lightning FAPI Jumpstart
 

Viewers also liked

All Things WordPress: Customizing Your Website with Advanced Custom Fields
All Things WordPress: Customizing Your Website with Advanced Custom FieldsAll Things WordPress: Customizing Your Website with Advanced Custom Fields
All Things WordPress: Customizing Your Website with Advanced Custom FieldsMickey Mellen
 
Time Savers Using The Treo Smartphone
Time Savers Using The Treo SmartphoneTime Savers Using The Treo Smartphone
Time Savers Using The Treo SmartphoneDoug Devitre
 
All Things WordPress: I Don't Have Time for This Meetup
All Things WordPress: I Don't Have Time for This MeetupAll Things WordPress: I Don't Have Time for This Meetup
All Things WordPress: I Don't Have Time for This MeetupMickey Mellen
 
5 Lessons In Real estate marketing
5 Lessons In Real estate marketing5 Lessons In Real estate marketing
5 Lessons In Real estate marketinghooox
 
Smooth website projects from start to finish
Smooth website projects from start to finishSmooth website projects from start to finish
Smooth website projects from start to finishMickey Mellen
 
Indispensable International Real Estate Communication Tactics
Indispensable International Real Estate Communication TacticsIndispensable International Real Estate Communication Tactics
Indispensable International Real Estate Communication TacticsDoug Devitre
 
All Things WordPress: The Essential Plugins You Need to Be Using
All Things WordPress: The Essential Plugins You Need to Be Using All Things WordPress: The Essential Plugins You Need to Be Using
All Things WordPress: The Essential Plugins You Need to Be Using Mickey Mellen
 
All Things WordPress: Blogging Strategies for 2017
All Things WordPress: Blogging Strategies for 2017All Things WordPress: Blogging Strategies for 2017
All Things WordPress: Blogging Strategies for 2017Mickey Mellen
 
The Now Wave to the Next Wave: public service delivery in a networked world
The Now Wave to the Next Wave: public service delivery in a networked worldThe Now Wave to the Next Wave: public service delivery in a networked world
The Now Wave to the Next Wave: public service delivery in a networked worldDominic Campbell
 
All Things WordPress: SEO That Works
All Things WordPress: SEO That WorksAll Things WordPress: SEO That Works
All Things WordPress: SEO That WorksMickey Mellen
 
All Things WordPress - The How, What and Why of SSLs
All Things WordPress - The How, What and Why of SSLsAll Things WordPress - The How, What and Why of SSLs
All Things WordPress - The How, What and Why of SSLsMickey Mellen
 
Inbound Marketing and Automation
Inbound Marketing and AutomationInbound Marketing and Automation
Inbound Marketing and AutomationMickey Mellen
 
Dos and Don'ts of Social Media for Real Estate
Dos and Don'ts of Social Media for Real EstateDos and Don'ts of Social Media for Real Estate
Dos and Don'ts of Social Media for Real EstateDoug Devitre
 
Real Estate portal solution
Real Estate portal solutionReal Estate portal solution
Real Estate portal solutionLatte Media
 
WordCamp ATL 2017 - Beginner Session - Plugins
WordCamp ATL 2017 - Beginner Session - PluginsWordCamp ATL 2017 - Beginner Session - Plugins
WordCamp ATL 2017 - Beginner Session - PluginsMickey Mellen
 
All Things WordPress: Getting the Most Out of Your Email Marketing
All Things WordPress: Getting the Most Out of Your Email MarketingAll Things WordPress: Getting the Most Out of Your Email Marketing
All Things WordPress: Getting the Most Out of Your Email MarketingMickey Mellen
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 

Viewers also liked (18)

All Things WordPress: Customizing Your Website with Advanced Custom Fields
All Things WordPress: Customizing Your Website with Advanced Custom FieldsAll Things WordPress: Customizing Your Website with Advanced Custom Fields
All Things WordPress: Customizing Your Website with Advanced Custom Fields
 
Time Savers Using The Treo Smartphone
Time Savers Using The Treo SmartphoneTime Savers Using The Treo Smartphone
Time Savers Using The Treo Smartphone
 
All Things WordPress: I Don't Have Time for This Meetup
All Things WordPress: I Don't Have Time for This MeetupAll Things WordPress: I Don't Have Time for This Meetup
All Things WordPress: I Don't Have Time for This Meetup
 
5 Lessons In Real estate marketing
5 Lessons In Real estate marketing5 Lessons In Real estate marketing
5 Lessons In Real estate marketing
 
Smooth website projects from start to finish
Smooth website projects from start to finishSmooth website projects from start to finish
Smooth website projects from start to finish
 
Indispensable International Real Estate Communication Tactics
Indispensable International Real Estate Communication TacticsIndispensable International Real Estate Communication Tactics
Indispensable International Real Estate Communication Tactics
 
All Things WordPress: The Essential Plugins You Need to Be Using
All Things WordPress: The Essential Plugins You Need to Be Using All Things WordPress: The Essential Plugins You Need to Be Using
All Things WordPress: The Essential Plugins You Need to Be Using
 
All Things WordPress: Blogging Strategies for 2017
All Things WordPress: Blogging Strategies for 2017All Things WordPress: Blogging Strategies for 2017
All Things WordPress: Blogging Strategies for 2017
 
The Now Wave to the Next Wave: public service delivery in a networked world
The Now Wave to the Next Wave: public service delivery in a networked worldThe Now Wave to the Next Wave: public service delivery in a networked world
The Now Wave to the Next Wave: public service delivery in a networked world
 
All Things WordPress: SEO That Works
All Things WordPress: SEO That WorksAll Things WordPress: SEO That Works
All Things WordPress: SEO That Works
 
All Things WordPress - The How, What and Why of SSLs
All Things WordPress - The How, What and Why of SSLsAll Things WordPress - The How, What and Why of SSLs
All Things WordPress - The How, What and Why of SSLs
 
Realestate
RealestateRealestate
Realestate
 
Inbound Marketing and Automation
Inbound Marketing and AutomationInbound Marketing and Automation
Inbound Marketing and Automation
 
Dos and Don'ts of Social Media for Real Estate
Dos and Don'ts of Social Media for Real EstateDos and Don'ts of Social Media for Real Estate
Dos and Don'ts of Social Media for Real Estate
 
Real Estate portal solution
Real Estate portal solutionReal Estate portal solution
Real Estate portal solution
 
WordCamp ATL 2017 - Beginner Session - Plugins
WordCamp ATL 2017 - Beginner Session - PluginsWordCamp ATL 2017 - Beginner Session - Plugins
WordCamp ATL 2017 - Beginner Session - Plugins
 
All Things WordPress: Getting the Most Out of Your Email Marketing
All Things WordPress: Getting the Most Out of Your Email MarketingAll Things WordPress: Getting the Most Out of Your Email Marketing
All Things WordPress: Getting the Most Out of Your Email Marketing
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Similar to Advanced Custom Fields - Flexible Content

Advanced Custom Fields: Amazing Possibilities and Irritating Limitations
Advanced Custom Fields: Amazing Possibilities and Irritating LimitationsAdvanced Custom Fields: Amazing Possibilities and Irritating Limitations
Advanced Custom Fields: Amazing Possibilities and Irritating LimitationsEast Bay WordPress Meetup
 
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/DeveloperWordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developermy easel
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress WebsitesKyle Cearley
 
Awetive template document
Awetive template documentAwetive template document
Awetive template documenttips 2u
 
Symfony Admin Generator - generator.yml
Symfony Admin Generator - generator.ymlSymfony Admin Generator - generator.yml
Symfony Admin Generator - generator.ymlRavi Mone
 
#PDR15 Creating Pebble Apps for Aplite, Basalt, and Chalk
#PDR15 Creating Pebble Apps for Aplite, Basalt, and Chalk#PDR15 Creating Pebble Apps for Aplite, Basalt, and Chalk
#PDR15 Creating Pebble Apps for Aplite, Basalt, and ChalkPebble Technology
 
Teacher is very picky, document must have all these thingsSean h.docx
Teacher is very picky, document must have all these thingsSean h.docxTeacher is very picky, document must have all these thingsSean h.docx
Teacher is very picky, document must have all these thingsSean h.docxbriankimberly26463
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesAndy Wallace
 
Joomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesJoomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesChris Davenport
 
OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.Andrew Yatsenko
 
The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210Mahmoud Samir Fayed
 
Various Ways of Using WordPress
Various Ways of Using WordPressVarious Ways of Using WordPress
Various Ways of Using WordPressNick La
 
WordPress as a Content Management System
WordPress as a Content Management SystemWordPress as a Content Management System
WordPress as a Content Management SystemValent Mustamin
 
Introduction to HTML-CSS-Javascript.pdf
Introduction to HTML-CSS-Javascript.pdfIntroduction to HTML-CSS-Javascript.pdf
Introduction to HTML-CSS-Javascript.pdfDakshPratapSingh1
 
SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2dan_mcweeney
 
Data Visualization With R: Learn To Modify Title, Axis Labels & Range
Data Visualization With R: Learn To Modify Title, Axis Labels & RangeData Visualization With R: Learn To Modify Title, Axis Labels & Range
Data Visualization With R: Learn To Modify Title, Axis Labels & RangeRsquared Academy
 

Similar to Advanced Custom Fields - Flexible Content (20)

Advanced Custom Fields: Amazing Possibilities and Irritating Limitations
Advanced Custom Fields: Amazing Possibilities and Irritating LimitationsAdvanced Custom Fields: Amazing Possibilities and Irritating Limitations
Advanced Custom Fields: Amazing Possibilities and Irritating Limitations
 
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/DeveloperWordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
Awetive template document
Awetive template documentAwetive template document
Awetive template document
 
Symfony Admin Generator - generator.yml
Symfony Admin Generator - generator.ymlSymfony Admin Generator - generator.yml
Symfony Admin Generator - generator.yml
 
#PDR15 Creating Pebble Apps for Aplite, Basalt, and Chalk
#PDR15 Creating Pebble Apps for Aplite, Basalt, and Chalk#PDR15 Creating Pebble Apps for Aplite, Basalt, and Chalk
#PDR15 Creating Pebble Apps for Aplite, Basalt, and Chalk
 
Teacher is very picky, document must have all these thingsSean h.docx
Teacher is very picky, document must have all these thingsSean h.docxTeacher is very picky, document must have all these thingsSean h.docx
Teacher is very picky, document must have all these thingsSean h.docx
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic Templates
 
Joomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic TemplatesJoomla Day UK 2009 Basic Templates
Joomla Day UK 2009 Basic Templates
 
Day seven
Day sevenDay seven
Day seven
 
TopicHero Descriptions Tutorial
TopicHero Descriptions TutorialTopicHero Descriptions Tutorial
TopicHero Descriptions Tutorial
 
OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.
 
a3.pdf
a3.pdfa3.pdf
a3.pdf
 
The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210
 
Various Ways of Using WordPress
Various Ways of Using WordPressVarious Ways of Using WordPress
Various Ways of Using WordPress
 
WordPress as a Content Management System
WordPress as a Content Management SystemWordPress as a Content Management System
WordPress as a Content Management System
 
Introduction to HTML-CSS-Javascript.pdf
Introduction to HTML-CSS-Javascript.pdfIntroduction to HTML-CSS-Javascript.pdf
Introduction to HTML-CSS-Javascript.pdf
 
IntroJs
IntroJsIntroJs
IntroJs
 
SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2SDN Mentor Hands On - Exercise 2
SDN Mentor Hands On - Exercise 2
 
Data Visualization With R: Learn To Modify Title, Axis Labels & Range
Data Visualization With R: Learn To Modify Title, Axis Labels & RangeData Visualization With R: Learn To Modify Title, Axis Labels & Range
Data Visualization With R: Learn To Modify Title, Axis Labels & Range
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
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
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
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
 
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
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
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
 
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
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
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
 
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
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
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
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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
 
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
 
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
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
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
 
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
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
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
 
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
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
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!
 
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!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
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
 

Advanced Custom Fields - Flexible Content

  • 1. Advanced custom fields Advanced Custom Fields plugin acts as a GUI layer for custom fields.
  • 2. Here is the difference between native custom fields and Advanced Custom Fields. It provides a much friendlier user interface to edit content.
  • 3. Advanced custom fields Flexible Content This allows users to enter an unlimited amount of layouts including repeating content with control over the order.
  • 4. ACF VERSIONS There is a free version, personal and PRO version of advanced custom fields. The personal version($20) is for one website, the PRO version is for unlimited sites. Plugin advanced custom fields PRO ($100). ● Plugin lets you create custom fields, as well as repeaters, flexible content, gallery, etc. ● We’re going to talk about defining your own webpage content layout using flexible content. http://www.advancedcustomfields.com/ ● Can create layouts that will allow users to enter just about any kind of content like text, video, galleries, maps and layouts.
  • 5. Goal Create homepage template where the user can enter content into a variety of layouts. Demo with the following content layouts: ● Hero with a background image and optional CTA button (uses conditional logic) ● Content with 1, 2 or 3 columns ● Content with 2 columns, one text, one image ● Image with caption ● Gallery ● FAQ’s (repeater)
  • 6. Once plugin is installed, we will: ● Create field group of type flexible content ● We can assign content to appear on a page, post or CPT, so when we edit our homepage, the layout will appear ● Can import/export code ● Can show or hide items
  • 7. Here is a list of all the possible field types we can use.
  • 8. Let’s start creating our layouts. This shows the Hero layout: ● Add new layout called Hero ● Add 5 fields ○ Hero image ○ Hero text ○ Display CTA button(this is a conditional field so user can turn this off or on) ○ Hero button URL ○ Hero button text There are 5 more layouts that we’ ve created.
  • 9. Let’s look at how this looks in the admin. Conditional Logic true/false Display button conditionally Conditional logic to show or hide button CTA button.
  • 10. Select field type for number of columns. Conditional logic to show or hide column 3. 1-3 Column layout (Services)
  • 11. FAQ’s using repeater field type. Sub Fields for question and answer.
  • 12. USER ENTERS CONTENT User can: ● Create layouts with desired content ● Drag to reorder any of the content
  • 13. CREATE TEMPLATE FILES IN THEME TO DISPLAY CONTENT What’s being used in theme: ● Theme with Bootstrap ● ACF plugin ● Flickity slider to display gallery
  • 14. Layout/File Structure Each ACF layout corresponds to a specific template I’m creating a template file for each layout type Theme fileshome-page.phpHomepage layout
  • 15. Main template file: home- template.php Check if we have rows If we have layout call: get_template_part() So if we have a hero layout call /partials/stripe-hero.php
  • 16. stripe-hero.php This is the template file that will display our hero content We use get_sub_field() to get the field values. Create HTML structure for our layout. Set background image Display field values Can use the_sub_field() to display fields.
  • 17. Note: In template files, we can use ACF functionality to display fields, or use WP function get_post_meta. Using get_post_meta will work even if plugin is removed or deactivated. $rows = get_post_meta( get_the_ID(), 'home_page_content', true ); if( !empty( $rows) ) { foreach( $rows as $count => $row ) { if ($row == 'hero') { // HERO $rows = get_post_meta( get_the_ID(), 'home_page_content', true ); if( !empty( $rows) ) { foreach( $rows as $count => $row ) { $hero_image = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_image', true ); $image_src = wp_get_attachment_image_src( $hero_image, 'full'); if ($hero_image) { $bg = wp_get_attachment_image( $image, 'large' ); } $content = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_text', true ); $display_cta_button = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_display_cta_button', true ); if ($display_cta_button) { $hero_button_url = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_button_url', true ); $hero_button_text = get_post_meta( get_the_ID(), 'home_page_content_' . $count . '_hero_button_text', true ); echo '<p class="cta"><a class="button" href="' . $hero_button_url . '">' . $hero_button_text . '</a></p>'; } } } } elseif ($row == ‘services’) { // SERVICES … } } }
  • 18. Let’s edit and display our content
  • 19. RESOURCES ● http://www.advancedcustomfields.com/ ● http://www.advancedcustomfields.com/resources/flexible-content/ ● Good documentation and example code on ACF website ● Videos show how to create layout similar to my demo ● Google search will take you to some good posts on how to create layouts Norm Euker - http://www.njedesign.com Demo: http://njedesign.com/demo/acf/