Brian DeConinck
Front-end designer, WordPress developer, & mathematics enthusiast at NC State University's Office of Information Technology
Campus-wide
Managed Multisites
Partner Unit
Multisites
Maintenance Contract
Single-Site Installs + Small Multisites
Rest of Campus...
WP Blogs
Hosted WP
OIT
ORIED
DASA
Arts
OFA
HR
OIT
ORIED
DASA
Arts
OFA
HR
Some of the sites we support...
WP Blogs
Hosted WP
Most of the sites we support...
We manage all of these sites and
support these users with...
But it's okay!
This system mostly works!
On a daily basis, most of our users...
Campus-wide
Managed Multisites
Partner Unit
Multisites
Maintenance Contract
Single-Site Installs + Small Multisites
Rest of Campus...
WP Blogs
Hosted WP
OIT
ORIED
DASA
Arts
OFA
HR
How do you make one of these in the Visual Editor?
Increasingly, users expect a flexible and robust page-building experience.
The Visual Editor on its own doesn't give them that.
There are three main focuses this year: the REST API, the editor, and the customizer...
The editor will endeavour to create a new page and post building experience...
So a user says,
"I need a page that
looks like this!"
What are our answers?
... but we can do better than that, right?
I stole these visuals from Jen Simmons.
Go watch her talk about this stuff!
The Only Two Types of Websites That Exist
Page-building plugins require:
Content from
Visual Editor
Set this in the Theme Options
Grid of "sidebar" widgets
And then they ask you to add another template to the theme!
THIS IS NOT SUSTAINABLE!
ACF
ACF
ACF
... or, if you use
Advanced Custom Fields
Advanced Custom Fields is great, but...
I mean, sure, it's fine. But let's be more ambitious!
What if I told you we could have...
Shortcodes + Shortcake
Shortcodes
Part of WordPress
since version 2.5
WP sees your shortcode and replaces it with a pre-defined block of HTML
function major_link_shortcode($atts, $content = null) {
extract(shortcode_atts(array(
'url' => null,
), $atts));
return sprintf(
'<a href="%s" class="major-link">%s <img
src="arrow.svg" aria-hidden="true" />',
esc_url( $attrs['url'] ),
$content
);
}
function register_shortcode(){
add_shortcode('major-link', 'major_link_shortcode');
}
add_action('init', 'register_shortcode');
[major-link url="https://www.ncsu.edu/"]Visit the NC State Homepage[/major-link]
Example:
Shortcake
"Feature Plugin"
= candidate for WP core
Now you can register a simple user interface for inserting shortcodes!
Shortcake
"Feature Plugin"
= candidate for WP core
Now you can register a simple user interface for inserting shortcodes!
shortcode_ui_register_for_shortcode(
'major-link',
array(
'label' => 'Major Link',
'listItemImage' => 'dashicons-arrow-right-alt',
'inner_content' => array(
'label' => 'Link Text',
'description' => 'Enter the text that will
be clicked on.',
),
'attrs' => array(
array(
'label' => 'URL',
'attr' => 'url',
'type' => 'url',
'description' => 'Enter your destination
URL.',
)
)
)
);
Not "Just Another Plugin"
If the Shortcake plugin stopped working tomorrow...
NC State Shortcodes
Shortcake-powered shortcode toolbox
Branded page elements for common needs at NC State
Now available through Cthulhu!
Hillsborough
OIT Design's main WordPress theme
Also available through Cthulhu!
Help me build this plugin!
Repository: github.ncsu.edu/oitdesign/ncsu-shortcodes
Wiki: go.ncsu.edu/shortcodes
Things I want to add:
They're still just shortcodes.
It's still just the Visual Editor.
There are three main focuses this year: the REST API, the editor, and the customizer...
The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.
But still!
Big changes to WordPress take time.
(See: REST API)
Shortcake-powered shortcodes are available now
and solve a lot of problems now, with few downsides.
And they have the potential to do a lot more!
Jen Simmons wants us to try things like this:
Now we can!
Recap
By Brian DeConinck
Front-end designer, WordPress developer, & mathematics enthusiast at NC State University's Office of Information Technology