Take Control of
Your Widgets
Kaspars Dambis
konstruktors.com
@konstruktors
WordCamp Norway 2013
Slide 2
Slide 2 text
Who is this guy?
Slide 3
Slide 3 text
Latvian Champion in Autocross, 2007
Slide 4
Slide 4 text
World's first electric race car
to finish Dakar rally in 2012
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
In ❤ since 2007
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
Custom Function Widgets
Slide 10
Slide 10 text
Custom Function Widgets
Slide 11
Slide 11 text
Widget Context
Version 0.1
Slide 12
Slide 12 text
A Sidebar?
Slide 13
Slide 13 text
Sidebar "Minima" for Blogger
Slide 14
Slide 14 text
Sidebar "Cubric" in WordPress 1.5 (2005)
Slide 15
Slide 15 text
Sidebar "Twenty Twelve" in WordPress (2012)
Slide 16
Slide 16 text
Sidebars are
for related content
Slide 17
Slide 17 text
Widgets in Core Widgets were first
provided by a plugin.
Available in core since
WP 2.2 (May 16, 2007).
Slide 18
Slide 18 text
Widgets in Core Available in core since
WP 2.2 (May 16, 2007).
Slide 19
Slide 19 text
Problems
1. Widgets are not attached to the content
2. Widgets can't be edited in context
BUT
Widgets provide flexibility
Slide 20
Slide 20 text
But Context Matters
Slide 21
Slide 21 text
Solutions
1. Use multiple widget areas (sidebars) and
templates to control their appearance
2. Use a plugin
Slide 22
Slide 22 text
Solutions
1. Use multiple widget areas (sidebars) and
templates to control their appearance
2. Use a plugin
Slide 23
Slide 23 text
Need to know Template Tags
(can't give to clients)
Uses evil() eval();
Widget Logic
Slide 24
Slide 24 text
WooSidebars
Sidebars as a custom post type.
Sidebars in context.
Slide 25
Slide 25 text
Creates a lot of widget
areas with custom
visibility rules which are
defined in another
section of the WordPress
dashboard.
WooSidebars
Slide 26
Slide 26 text
Display Widgets
Adds context UI to widget settings.
Slide 27
Slide 27 text
Individual posts and
pages can be targeted
only by URL patterns,
which are hard to
understand.
Widget Context
Adds context UI to widget settings.
Slide 28
Slide 28 text
Problems
1. Widgets can't be edited on per-page basis.
2. Widgets can't be re-ordered
on per-page basis
Slide 29
Slide 29 text
Widget Context
Experiments
Slide 30
Slide 30 text
Concept A
Bring Widget UI into Page Edit Screen
Slide 31
Slide 31 text
Features:
Per-page settings;
Re-order widgets.
Problems:
Adding and hiding
new widgets requires
editing all pages
Concept A
Slide 32
Slide 32 text
Concept A Demo
Slide 33
Slide 33 text
Simple Show/Hide
option with a list of
available rules.
Concept B
Slide 34
Slide 34 text
Concept B Demo
Slide 35
Slide 35 text
Concept C
Slide 36
Slide 36 text
Concept C Demo
Slide 37
Slide 37 text
Conclusions
1. Current setup (Sidebar UI) doesn't allow
granular widget control.
2. Granular setup (Post Edit UI) is hard to
manage on large scale sites.