Building excellent web experiences
with
Advanced Custom Fields and Visual Composer
Stanislav Khromov�WordCamp Norrköping 2014
About me
Stanislav Khromov
Web developer at IDG Sweden
This talk
Meet the cast
WordPress Core features
[gallery]
[gallery ids="729,732,731"]
Meet the cast
Plugins
Custom Post Types - Goals
What do we want?
Custom Post Types - Example
Interface for creating a custom post type i Custom Post Types UI.
Don’t forget the Advanced Options!
Custom Post Types - Exporting
CPT UI lets us export to code!
But where do we put this code and how do we organize it?
Custom Post Types - A plugin
Our CPT Plugin
Custom Post Types - custom-cpt.php
Problem:�Post types will be loaded twice. (Once from code, once from database.)
Custom Post Types - custom-cpt.php
Solution:
Add a config variable to wp-config.php and load conditionally.
Custom Post Types - custom-cpt.php
Improved Custom CPT plugin:
Thought process
Create CPT (Visual)
Configure CPT (Visual)
Export to
PHP file
Commit to version control
What did we accomplish?
Result = A good workflow for working with Custom Post Types
Moving on to
Custom Fields
Custom Fields
What do we want?
Custom Fields - Example
Advanced Custom Fields provides an interface for creating custom fields that are grouped into Field Groups - collection of fields that can be attached onto a post type.
Custom Fields - Exporting
ACF lets us export field groups!
Custom Fields - Plugin
You know the drill.
Same basic idea as the CPT plugin!
Thought process
Create field groups and fields (Visual)
Configure field groups
and fields (Visual)
Export to
PHP file
Commit to version control
What did we accomplish?
Result = A good workflow for working with fields
Moving on to
[shortcodes]
Shortcodes
What do we want?
A typical shortcode
Custom Shortcodes plugin
Custom Shortcodes plugin
A typical shortcode
A typical shortcode - CSS
+ media queries in separate file
Custom Shortcodes plugin
Load libraries on plugins_loaded�Load shortcodes on after_setup_theme
Load CSS/JS on wp_enqueue_scripts
Shortcodes
What did we accomplish?
Performance
http://wordpress.org/plugins/minqueue/
Let’s talk
user experience
Visual Content Builders
Before and after
Demo
Integrating a shortcode is easy!
Documentation of parameters available at:
http://kb.wpbakery.com/index.php?title=Vc_map
From regular shortcode to Visual Composer block in a few rows of code!
Integrating a shortcode is easy!
But where do we put this code?
Our shortcode plugin!
Thought process
Case Study
IDG Event Sites
End results
Demo!
Open source!
https://github.com/khromov/wp-custom-cpt
https://github.com/khromov/wp-custom-fields
https://github.com/khromov/wp-custom-shortcodes
Thank you!
Questions?