ElasticYour theme’s future WYSIWYG editor.Daryl Koopersmith
Who is this guy?Daryl KoopersmithWordPress: Google Summer of Code 2009Junior, Washington University in St. Louisdaryl@elastictheme.org@drylk
ThanksBeau LebensAutomatticianAmazing mentor
ThanksJane WellsAutomatticianGSoC and WCNYC organizer
What makesWordPress great?
You
What else makesWordPress great?
FlexibilityCaters to every difficulty levelAll flexible, except…
Theme OptionsRely on theme developersVary in quality, often bloatedLeave a lot to be desired
Introducing ElasticA WYSIWYG theme editor for WordPress.
User GroupsAverage usersDevelopers
The Editor
Freedom
Infinite LayoutsUsing modulesWYSIWYKOG
Any StyleLive editingWYSIWYGThe typography panel
“Some people are going to make some ________________________themes with this.”—Beau LebensFLOWERY ADJECTIVES
“Some people are going to make some crazy-ugly Myspace-style themes with this.”—Beau Lebens
So pretty.
Demo.Get excited.
The FrameworkThe foundation. The nitty-gritty.Hang on to your hats, folks. We’re in for a bumpy ride.
You say tomato,I say tomahhto.
Modular ThemingCan be created by an editorCreate only what’s necessaryDRY
LayoutEditor friendlyDefined in one fileReadableA Basic Layout$layout = new Layout( array(new Header(),new Group(‘container’, array(new Content(),new Sidebar(‘primary’),new Sidebar(‘secondary’)))));
Built-in Modules
Context in WordPress
Context & InheritanceLevels of contextSpecificCascade
Context in WordPress
Contextual HooksThe APIA day in the life of…elastic_do_cascade(“hook”);Context-specific hookselastic_do_specific();elastic_apply_specific();Cascading hookselastic_do_cascade();elastic_apply_cascade();Formats hooks for youelastic_format_hook();
ViewsVisual representation of a context
Views in WordPresspage-level
what if you…Make views module-level?
Views in Elasticmodule-levelHeader Viewindex.phpContent ViewPage Viewtag-5.phpSidebarViewarchive.php
module-level views meanFine-grained control
combining concepts:Module Views
Module APIs
Framework Filesystem/library/customstyle.css
/custom contains:View foldersOne for each module typeContain views for that module typefunctions.phpstyle.css
Sounds complicated.Where do I come in?
Is it hard to make a Framework theme?Do I have to rewrite my themes from scratch?
NOIn fact, it’s mostlycopy-and-paste.
WP Theme ConventionsMost themes have a consistent layoutMost files differ only in the Content section
Most WP theme files look something like this:<?phpget_header(); ?><div id=“wrapper”>	<div id=“content”><!-- Content goes here -->	</div>	<?php include (TEMPLATEPATH . '/sidebar.primary.php'); ?>	<?php include (TEMPLATEPATH . '/sidebar.secondary.php'); ?></div><?phpget_footer(); ?>Adapting Your Theme
Write a layout fileOne layout file for the entire themeMatch modules with <div> elements
Write a layout file
Write a content viewTypical WP theme file:<?phpget_header(); ?><div id=“wrapper”>	<div id=“content”><!-- Content goes here -->	</div>	<?php include (TEMPLATEPATH . '/sidebar.primary.php'); ?>	<?php include (TEMPLATEPATH . '/sidebar.secondary.php'); ?></div><?phpget_footer(); ?>Step 1: COPY<!-- Content goes here -->Content view file:Step 2: PASTE<!-- Content goes here -->
A Problem
The editor needs a starting point.
A default theme?Get the user startedPreset module viewsStill limiting!Stuck with the default HTML
How can the editor harness the framework’s power?
Base ThemesConnecting the framework and the editor.
The BridgeEditor ThemeBase ThemeFramework ThemeLibrary
What is a base theme?A templateA set of modules used in the Editor
Considerations&Implications
Flexibility can bedangerous
Remember…Modular themes.Infinite layouts.Any style.
My CSS is pixel perfect!One small change and—
Not good for the developer,not good for the user.Nobody enjoys a broken themeWYSIWYG can be overwhelmingHundreds of HTML elements
Controlled flexibility
ConsistencyTypographyColor palettesGrids
ElasticCSSExtension of CSS languageFamiliar!Easy to adapt framework themes
Custom ModulesPackage complex CSSBreadcrumbs, menus, etc.
Combine modules from multiple base themes
Theme Distribution
Where do themes live?
Where do themes live?Editor ThemesThe databaseExport as a child theme
DistributionChild themes aren’t on WP Extend
What can I do?
Elastic is a huge project
I am a student(I’m not bald, though.)
If you’re interested…Expand and improve the Editor UIDevelop database interactionCreate an ElasticCSS interpreterImprove the FrameworkWrite documentationTesting, testing, testing!
Get in touch.Daryl Koopersmithelastictheme.orgdaryl@elastictheme.orgIRC: koopersmith@drylk
Questions? Comments?Daryl Koopersmithelastictheme.orgdaryl@elastictheme.orgIRC: koopersmith@drylk

Elastic: Why WYSIWYG is the future of WordPress themes — WordCamp NYC 2009

Editor's Notes

  • #23 For elastic,framework != parent theme Not just a collection of hooks and functions Changes how WP themes work
  • #31 All WordPress pages have a contextBest match vs contextWP themes don’t inheritCascading:Context with inheritance
  • #34 The way something appears in the browser.
  • #35 Page-level, but really only differ with content
  • #36 One module at a time as opposed to one page at a time
  • #37 Why stop at module level?Comparisons to CarringtonAdds another (unnecessary) level of abstractionCrucial to a central layout, prevents repetition
  • #38 Change the header on the home pageHide a “contact” sidebar on the contact page
  • #39 Best of both worldsRun the most context-specific viewPass the result into a cascading filter
  • #41 style.cssThe only file outside of /custom you editOnly states the theme informationStyles defined in /custom/style.css
  • #42 Give examples for view folders
  • #51 This is why we don’t break modules down further—compatibility
  • #54 WP themes have different HTML structures
  • #61 Blessing and a curse.The user controls the layout of the theme.
  • #64 Can the user edit every HTML element?How does the editor know what the user can change?
  • #65 What can the user change?
  • #67 Fix the height of a headerParsed by PHP: create color palettes, linked styles
  • #68 Module settings.
  • #69 Standalone modules.
  • #72 The database:MU compatible!Avoids filesystem issues.Export as child theme:Includes any base theme files. (Grandchild themes don’t exist.)