SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Advanced Custom Fields
Flexible layouts and other cool stuff!
by Kirsty Burgoine
www.kirstyburgoine.co.uk
twitter.com/kirstyburgoine
info@kirstyburgoine.co.uk
Who am I?
New Years Eve 2012
Birmingham ComicCon 2013
Kirsty Burgoine
WordPress developer / web designer
• www.kirstyburgoine.co.uk
• info@kirstyburgoine.co.uk
• twitter.com/kirstyburgoine
Organiser of Shropgeek
• Monthly socials
• Rebellion - mini conferences
• (R)Evolution web conference
27th, September 2013
2013.shropgeek-revolution.co.uk
Advanced Custom Fields	by Elliot Condon
- Using the location field with Google Maps API
- Flexible Content
- Images field
www.speaktheweb.org July 24th
The Client
A little about Advanced Custom Fields ...
General Settings
• Adding the group and field
Label, Name, Type, Conditional
Logic
• Location
Show on specific pages, posts,
taxonomy etc.
• Options
Position, Style, hide on screen
Creating Custom Fields
Google Maps & the Locations field
What you will need:
• Location Field
• Knowledge of Google Maps API v3
The location field is a free add on.
http://www.advancedcustomfields.com/add-ons/
Creating the Location field
And here’s one I made earlier....
Creating the locations
Create a new page
for each separate
location.
The location field
group is set to only
show on child
pages of the main
locations page.
Displaying each location on the page
Step 1
Add the google map container <div> to content-page.php
In this case the post parent is our main locations page.
The container has been added outside of .content-entry to avoid any distortion
caused by the CSS .content-entry img { max-width: 100%; }
Displaying each location on the page
Step 2
Within the loop get the locations field using get_field();
Add the javascript for Google maps
Displaying each location on the page
The location field is an array that allows you to use the original address inputted
and the coordinates returned.
In the example given, we used $post_code[‘coordinates’] in the Google maps
javascript.
Notice there is also a custom image for the map marker here.
Displaying all locations on one map
Step 1
Create the main page template: locations-main.php
Step 2
Add the google map container <div> to the page
Step 3
Create the map and add the markers ...
Displaying all locations on one map
Step 3 continued.
Create a new loop that
finds all of the location
coordinates.
This loop then needs
to insert all of the
information into an
array called $marker
for later use in a our
javascript.
Displaying all locations on one map
Step 3 continued.
The Javascript.
This example shows how each
marker is created and where it
is placed.
Full code can be found in
locations-main.php
The Flexible Content field
What you will need:
• Flexible Content Field
• Repeater Field
Both are premium fields and cost $25.00 AUD each.
http://www.advancedcustomfields.com/add-ons/
Creating the Flexible Content field
And here’s one I made earlier....
Editing the Fields
• Layouts - This will display in popup when editing the page
• Create sub field within the layout that could be used for Flexible content.
• For multiple columns set as a Repeater Field
• Add repeater fields inside the sub field
• Set a maximum number of rows. This will make your CSS easier to manage.
• For more layouts, click Add New under each layout and repeat process
Adding flexible content to the page
And here’s one I made earlier....
Building the flexible content into our theme
Step 1
Create the main page template: flexible-content.php
In that template create a new loop for the flexible content within the main loop
using has_field()
The page template
Step 2
Create the template part for each layout.
content-flexible-text.php
content-flexible-carousel.php
Careful to use the name of the layout i.e. text, carousel
We can now automatically pull in the right type of content based on the selection
made in the admin panel
The template part
Example used here is content-flexible-text.php
First of all we need to get all of the content from the Text Flexible Content Field
$columns is a repeater field so we initiate a new loop and get all of the content
from each sub field
The template part
Then display the content:
The template part - CSS
Step 3
Setup the columns to create their class dynamically
$columns is our repeater field. $text_count counts the number of fields created.
We originally limited our columns to 4 when creating the flexible content field so we
know the classes created here will be .span1, .span2, .span3, .span4
The template part - CSS
Making the columns responsive:
As well as the CSS I also used fitvids.js to make the videos responsive
Dealing with Images
What you will need:
• Gallery Field
The gallery field is a premium add on and costs $25.00 AUD.
http://www.advancedcustomfields.com/add-ons/
Dealing with Images
And here’s one I made earlier....
Images and the Gallery field type
Image Return
Values
The Image Object
array returns a lot of
information we can
use:
Gallery field type
Gallery field automatically stores all information about each image in an
Image Object.
This allows us to do some cool stuff with them.
Creating a gallery of images
Create the flexible content field for the gallery.
Here’s one I made earlier ...
Creating a gallery of images
Create the template part for the layout. This will be a flexible layout as well.
content-flexible-carousel.php
Once created, get all of the content from the flexible content carousel fields
$carousel_images is an array so we need to create a foreach loop to access all of
the information
Creating a gallery of images
To create the carousel I used flexslider 2 from Woothemes:
http://flexslider.woothemes.com/index.html
Thank you.
Credits	and Resources
• www.advancedcustomfields.com
• fitvidsjs.com/
• flexslider.woothemes.com/index.html
• placekitten.com
• www.kirstyburgoine.co.uk
• twitter.com/kirstyburgoine
• info@kirstyburgoine.co.uk
All theme files can be found on github at:
• https://github.com/kirstyburgoine/wcuk2013

Weitere ähnliche Inhalte

Andere mochten auch

Fichas Ciencias Políticas Cuarto Periodo
Fichas Ciencias Políticas Cuarto PeriodoFichas Ciencias Políticas Cuarto Periodo
Fichas Ciencias Políticas Cuarto PeriodoJuan Ochoa Carvajal
 
Morning report kasus pre op
Morning report kasus pre op Morning report kasus pre op
Morning report kasus pre op Rizka Khairiza
 
Game Design Workshop, Issue #001
Game Design Workshop, Issue #001Game Design Workshop, Issue #001
Game Design Workshop, Issue #001Sun Moon Hwang
 
PROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANA
PROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANAPROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANA
PROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANAdelmibenites
 
Manthan banarasia
Manthan banarasiaManthan banarasia
Manthan banarasiaVikas Dangi
 
Frases en inglés para retrasar o adelantar citas
Frases en inglés para retrasar o adelantar citasFrases en inglés para retrasar o adelantar citas
Frases en inglés para retrasar o adelantar citaspatricianavarroc
 
Classical Electrodynamics - John David Jackson
Classical Electrodynamics -  John David JacksonClassical Electrodynamics -  John David Jackson
Classical Electrodynamics - John David JacksonJefferson Londoño Cardoso
 

Andere mochten auch (10)

copasst
copasstcopasst
copasst
 
Fichas Ciencias Políticas Cuarto Periodo
Fichas Ciencias Políticas Cuarto PeriodoFichas Ciencias Políticas Cuarto Periodo
Fichas Ciencias Políticas Cuarto Periodo
 
Electrostatic as a source of power in an aircraft
Electrostatic as a source of power in an aircraftElectrostatic as a source of power in an aircraft
Electrostatic as a source of power in an aircraft
 
Morning report kasus pre op
Morning report kasus pre op Morning report kasus pre op
Morning report kasus pre op
 
Game Design Workshop, Issue #001
Game Design Workshop, Issue #001Game Design Workshop, Issue #001
Game Design Workshop, Issue #001
 
PROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANA
PROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANAPROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANA
PROYECTO PRODUCTIVO BIOHUERTO NUEVA SULLANA
 
Manthan banarasia
Manthan banarasiaManthan banarasia
Manthan banarasia
 
Frases en inglés para retrasar o adelantar citas
Frases en inglés para retrasar o adelantar citasFrases en inglés para retrasar o adelantar citas
Frases en inglés para retrasar o adelantar citas
 
Classical Electrodynamics - John David Jackson
Classical Electrodynamics -  John David JacksonClassical Electrodynamics -  John David Jackson
Classical Electrodynamics - John David Jackson
 
Campos Electromagneticos - Roald Wangness
Campos Electromagneticos -  Roald WangnessCampos Electromagneticos -  Roald Wangness
Campos Electromagneticos - Roald Wangness
 

Ähnlich wie WP London Meetup - August 2013

Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Peter Vanhee
 
WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...Denise Williams
 
Creating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalCreating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalDaniel Downs
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceRachel Andrew
 
Opentext exstream dialogue online training | Opentext exstream dialogue train...
Opentext exstream dialogue online training | Opentext exstream dialogue train...Opentext exstream dialogue online training | Opentext exstream dialogue train...
Opentext exstream dialogue online training | Opentext exstream dialogue train...Selfpaced
 
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
 
Stupid Index Block Tricks
Stupid Index Block TricksStupid Index Block Tricks
Stupid Index Block Trickshannonhill
 
Design patterns
Design patternsDesign patterns
Design patternsnisheesh
 
Contentful with Netgen Layouts workshop
Contentful with Netgen Layouts workshopContentful with Netgen Layouts workshop
Contentful with Netgen Layouts workshopIvo Lukac
 
Sass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LASass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LAJake Johnson
 
Web development basics (Part-2)
Web development basics (Part-2)Web development basics (Part-2)
Web development basics (Part-2)Rajat Pratap Singh
 
Skroutz redesign - How to approach card-based design & SASS content - specifi...
Skroutz redesign - How to approach card-based design & SASS content - specifi...Skroutz redesign - How to approach card-based design & SASS content - specifi...
Skroutz redesign - How to approach card-based design & SASS content - specifi...Skroutz S.A.
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond bloggingJulien Minguely
 
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]David Wesst
 
From Zero to Hero – Web Performance
From Zero to Hero – Web PerformanceFrom Zero to Hero – Web Performance
From Zero to Hero – Web PerformanceSebastian Springer
 
Creating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalCreating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalDaniel Downs
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing worldRuss Weakley
 
What's new in Mondrian 4?
What's new in Mondrian 4?What's new in Mondrian 4?
What's new in Mondrian 4?Julian Hyde
 

Ähnlich wie WP London Meetup - August 2013 (20)

Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8
 
WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...WordPress Custom Fields: Control your content presentation by breaking out of...
WordPress Custom Fields: Control your content presentation by breaking out of...
 
Creating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalCreating a web gallery lightbox2 final
Creating a web gallery lightbox2 final
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP Conference
 
Opentext exstream dialogue online training | Opentext exstream dialogue train...
Opentext exstream dialogue online training | Opentext exstream dialogue train...Opentext exstream dialogue online training | Opentext exstream dialogue train...
Opentext exstream dialogue online training | Opentext exstream dialogue train...
 
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
 
Stupid Index Block Tricks
Stupid Index Block TricksStupid Index Block Tricks
Stupid Index Block Tricks
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Contentful with Netgen Layouts workshop
Contentful with Netgen Layouts workshopContentful with Netgen Layouts workshop
Contentful with Netgen Layouts workshop
 
Sass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LASass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LA
 
Web development basics (Part-2)
Web development basics (Part-2)Web development basics (Part-2)
Web development basics (Part-2)
 
Skroutz redesign - How to approach card-based design & SASS content - specifi...
Skroutz redesign - How to approach card-based design & SASS content - specifi...Skroutz redesign - How to approach card-based design & SASS content - specifi...
Skroutz redesign - How to approach card-based design & SASS content - specifi...
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond blogging
 
React-Native Lecture 11: In App Storage
React-Native Lecture 11: In App StorageReact-Native Lecture 11: In App Storage
React-Native Lecture 11: In App Storage
 
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
 
From Zero to Hero – Web Performance
From Zero to Hero – Web PerformanceFrom Zero to Hero – Web Performance
From Zero to Hero – Web Performance
 
Creating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalCreating a web gallery lightbox2 final
Creating a web gallery lightbox2 final
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
What's new in Mondrian 4?
What's new in Mondrian 4?What's new in Mondrian 4?
What's new in Mondrian 4?
 
Cain & Obenland — Episode 4
Cain & Obenland — Episode 4Cain & Obenland — Episode 4
Cain & Obenland — Episode 4
 

Mehr von Kirsty Burgoine

Smile - Its never that bad! Mastering the sales meeting without turning to th...
Smile - Its never that bad! Mastering the sales meeting without turning to th...Smile - Its never that bad! Mastering the sales meeting without turning to th...
Smile - Its never that bad! Mastering the sales meeting without turning to th...Kirsty Burgoine
 
The dark art of sales meetings - WordCamp Bournemouth Version
The dark art of sales meetings - WordCamp Bournemouth VersionThe dark art of sales meetings - WordCamp Bournemouth Version
The dark art of sales meetings - WordCamp Bournemouth VersionKirsty Burgoine
 
Question of deliverables and other such stuff
Question of deliverables and other such stuffQuestion of deliverables and other such stuff
Question of deliverables and other such stuffKirsty Burgoine
 
Speak the Web - Liverpool 24.07.13
Speak the Web - Liverpool 24.07.13Speak the Web - Liverpool 24.07.13
Speak the Web - Liverpool 24.07.13Kirsty Burgoine
 
Working with designers that dont code
Working with designers that dont codeWorking with designers that dont code
Working with designers that dont codeKirsty Burgoine
 

Mehr von Kirsty Burgoine (8)

Wpldn july2015 usb
Wpldn july2015 usbWpldn july2015 usb
Wpldn july2015 usb
 
WC Birmingham 2015
WC Birmingham 2015WC Birmingham 2015
WC Birmingham 2015
 
Smile - Its never that bad! Mastering the sales meeting without turning to th...
Smile - Its never that bad! Mastering the sales meeting without turning to th...Smile - Its never that bad! Mastering the sales meeting without turning to th...
Smile - Its never that bad! Mastering the sales meeting without turning to th...
 
The dark art of sales meetings - WordCamp Bournemouth Version
The dark art of sales meetings - WordCamp Bournemouth VersionThe dark art of sales meetings - WordCamp Bournemouth Version
The dark art of sales meetings - WordCamp Bournemouth Version
 
Question of deliverables and other such stuff
Question of deliverables and other such stuffQuestion of deliverables and other such stuff
Question of deliverables and other such stuff
 
Speak the Web - Liverpool 24.07.13
Speak the Web - Liverpool 24.07.13Speak the Web - Liverpool 24.07.13
Speak the Web - Liverpool 24.07.13
 
Extending word press
Extending word pressExtending word press
Extending word press
 
Working with designers that dont code
Working with designers that dont codeWorking with designers that dont code
Working with designers that dont code
 

Kürzlich hochgeladen

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Kürzlich hochgeladen (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

WP London Meetup - August 2013

  • 1. Advanced Custom Fields Flexible layouts and other cool stuff! by Kirsty Burgoine www.kirstyburgoine.co.uk twitter.com/kirstyburgoine info@kirstyburgoine.co.uk
  • 5. Kirsty Burgoine WordPress developer / web designer • www.kirstyburgoine.co.uk • info@kirstyburgoine.co.uk • twitter.com/kirstyburgoine Organiser of Shropgeek • Monthly socials • Rebellion - mini conferences • (R)Evolution web conference
  • 6.
  • 8. Advanced Custom Fields by Elliot Condon - Using the location field with Google Maps API - Flexible Content - Images field
  • 11. A little about Advanced Custom Fields ...
  • 12. General Settings • Adding the group and field Label, Name, Type, Conditional Logic • Location Show on specific pages, posts, taxonomy etc. • Options Position, Style, hide on screen Creating Custom Fields
  • 13. Google Maps & the Locations field What you will need: • Location Field • Knowledge of Google Maps API v3 The location field is a free add on. http://www.advancedcustomfields.com/add-ons/
  • 14. Creating the Location field And here’s one I made earlier....
  • 15. Creating the locations Create a new page for each separate location. The location field group is set to only show on child pages of the main locations page.
  • 16. Displaying each location on the page Step 1 Add the google map container <div> to content-page.php In this case the post parent is our main locations page. The container has been added outside of .content-entry to avoid any distortion caused by the CSS .content-entry img { max-width: 100%; }
  • 17. Displaying each location on the page Step 2 Within the loop get the locations field using get_field(); Add the javascript for Google maps
  • 18. Displaying each location on the page The location field is an array that allows you to use the original address inputted and the coordinates returned. In the example given, we used $post_code[‘coordinates’] in the Google maps javascript. Notice there is also a custom image for the map marker here.
  • 19. Displaying all locations on one map Step 1 Create the main page template: locations-main.php Step 2 Add the google map container <div> to the page Step 3 Create the map and add the markers ...
  • 20. Displaying all locations on one map Step 3 continued. Create a new loop that finds all of the location coordinates. This loop then needs to insert all of the information into an array called $marker for later use in a our javascript.
  • 21. Displaying all locations on one map Step 3 continued. The Javascript. This example shows how each marker is created and where it is placed. Full code can be found in locations-main.php
  • 22. The Flexible Content field What you will need: • Flexible Content Field • Repeater Field Both are premium fields and cost $25.00 AUD each. http://www.advancedcustomfields.com/add-ons/
  • 23. Creating the Flexible Content field And here’s one I made earlier....
  • 24. Editing the Fields • Layouts - This will display in popup when editing the page • Create sub field within the layout that could be used for Flexible content. • For multiple columns set as a Repeater Field • Add repeater fields inside the sub field • Set a maximum number of rows. This will make your CSS easier to manage. • For more layouts, click Add New under each layout and repeat process
  • 25. Adding flexible content to the page And here’s one I made earlier....
  • 26. Building the flexible content into our theme Step 1 Create the main page template: flexible-content.php In that template create a new loop for the flexible content within the main loop using has_field()
  • 27. The page template Step 2 Create the template part for each layout. content-flexible-text.php content-flexible-carousel.php Careful to use the name of the layout i.e. text, carousel We can now automatically pull in the right type of content based on the selection made in the admin panel
  • 28. The template part Example used here is content-flexible-text.php First of all we need to get all of the content from the Text Flexible Content Field $columns is a repeater field so we initiate a new loop and get all of the content from each sub field
  • 29. The template part Then display the content:
  • 30. The template part - CSS Step 3 Setup the columns to create their class dynamically $columns is our repeater field. $text_count counts the number of fields created. We originally limited our columns to 4 when creating the flexible content field so we know the classes created here will be .span1, .span2, .span3, .span4
  • 31. The template part - CSS Making the columns responsive: As well as the CSS I also used fitvids.js to make the videos responsive
  • 32. Dealing with Images What you will need: • Gallery Field The gallery field is a premium add on and costs $25.00 AUD. http://www.advancedcustomfields.com/add-ons/
  • 33. Dealing with Images And here’s one I made earlier....
  • 34. Images and the Gallery field type Image Return Values The Image Object array returns a lot of information we can use:
  • 35. Gallery field type Gallery field automatically stores all information about each image in an Image Object. This allows us to do some cool stuff with them.
  • 36. Creating a gallery of images Create the flexible content field for the gallery. Here’s one I made earlier ...
  • 37. Creating a gallery of images Create the template part for the layout. This will be a flexible layout as well. content-flexible-carousel.php Once created, get all of the content from the flexible content carousel fields $carousel_images is an array so we need to create a foreach loop to access all of the information
  • 38. Creating a gallery of images To create the carousel I used flexslider 2 from Woothemes: http://flexslider.woothemes.com/index.html
  • 40. Credits and Resources • www.advancedcustomfields.com • fitvidsjs.com/ • flexslider.woothemes.com/index.html • placekitten.com • www.kirstyburgoine.co.uk • twitter.com/kirstyburgoine • info@kirstyburgoine.co.uk All theme files can be found on github at: • https://github.com/kirstyburgoine/wcuk2013