SlideShare a Scribd company logo
Building a Simple
Theme Framework
by: Joe Casabona
Who am I?
• Native of NYS
• Yankee Fan
• WordPress Developer
• Computer Nerd
• Star Wars Nerd
• Author of
BuildingWordPressThemes from Scratch
Software Reuse
• Some General Principles & Tips
Software Reuse
• What is it? Creating code that can be used
across several projects. Using existing software
to create new software.
• Why is it Important?
• It saves time
• It’s easier to test
• It allows you to focus on more advanced
parts of a project.
Principles of Reuse
• DesignYour Code
• Layout functions, classes, page templates before
hand!
• Generalize Where Possible
• Recognize when you’re reusing code snippets
• Document & Test Thoroughly!
• Testing will ensure your code works before
implementing it 5, 10, or 20 times
DefineYour Needs
• We all have different needs!
• I’ll talk about mine. Keep yours in mind.
• EvaluateYour Process
• ReviewYour Code
• What do you do over and over?
• Look for the same code across recent
projects!
DefineYour Needs (my needs)
• Plugable CSS
• Constants for Theme & Image URLS
• Common WordPress functionality (menus,
sidebars, CPTs, etc.)
• Most Common theme templates (header, footer,
page, index)
• Common Folders
• Lightweight
Now What?
• You know what you needs. Now what?
• Before you code, see what’s out there!
• Can a plugin or other theme fulfill your
needs?
• Is there already some theme you use as a
starting point?
What’s Out There (themes)
• Thematic
• Thesis
• Carrington
• Genesis
• Atahualpa
What’s Out There (Plugins)
• OptionTree
• Custom Post Type UI
• Royal Slider
• Contact Form 7
Building the Framework
• What to do, what to do...
DesigningYour Code
• I noticed I was doing a couple of things over and over
• Copy K2
• Rip out stuff I didn't use
• Replace it with my standard template
• Modify
• Eventually, I would just copy the last theme I created
• I took my common components and created my
framework
Ex: Post Attachments
) { setup_postdata($post);
the_attachment_link($post->ID, false, false,
true); }}}
if ($attachments) {foreach ( $attachments as $post
) { setup_postdata($post);
the_attachment_link($post->ID, false, false,
true); }}}
if ($attachments) {foreach ( $attachments as $post
) { setup_postdata($post);
the_attachment_link($post->ID, false, false,
true); }}}
if ($attachments) {foreach ( $attachments as
$post ) { setup_postdata($post);
the_attachment_link($post->ID, false, false,
true); }}}
if ($attachments) {foreach ( $attachments as $post
) { setup_postdata($post);
the_attachment_link($post->ID, false, false,
true); }}}
if ($attachments) {foreach ( $attachments as $post
Necessary Files
• Style.css
• Functions.php
• Index.php
• That’s it! WordPress will fill in the blanks
with only these.
Recommended Files
• All Necessary files
• header.php & footer.php
• page.php
• single.php
• A Custom Post Type generator/template
• A theme options generator/template
• search.php
• archive.php
• sidebar.php
My CSS
• Single Sheet
• Compressed normalize.css
• Some base styles
• Standard HTML5 Elements
• Basic Navigation CSS
• Mobile first approach
• Basic Media Queries
• Any common classes and IE Fixes
My Functions
• Constants to use throughout the whole theme:
define( 'TEMPPATH', get_bloginfo('stylesheet_directory'));
define( 'IMAGES', TEMPPATH. "/images");
• Calls to include:
• Nav Menus
• Sidebars (2)
• Custom functions I use across multiple themes
(like attachments function from earlier)
Using the Framework
• How and When
• As a Child Theme:
• Cleaner
• Easier to update
• Can overwrite any page
• As a Boilerplate:
• One off jobs you don’t plan on updating
• Largely customized jobs where you want to
reuse only parts of the framework.
2 Ways to Use Framework
As a Child Theme
• Allows you to create themes that will automatically get
updated when you update your framework
• Bug Fixes
• Additional Functionality
• General Theme Updates
• Overwrites
• No need to hack together/delete. Import and overwrite!
As a Boilerplate
• Did this for a while!
• This project started to serve as a simple
boilerplate for me
• Use for one-off projects
• Projects you won't have control over after initial
launch
• Projects that will be deeply different structurally
Which Should I Use?
• Cliche Answer: It Depends!
• As with most things in our field, there is no be-all-
end-all answer.
• Consider the project at hand and make the call
there.
• Practically speaking, a child theme of your
framework will likely work most of the time.
Some Tips
• Test it thoroughly
• You will use this a lot, so make sure things work
as expected across multiple browsers
• Improve and update it
• As you grow as a developer, your needs will
change. Make sure your framework changes with
you.
Some Tips (cont)
• Don't get complacent
• Do let your growth stagnate because you're using
a framework.
• Stay up on new features, best practices, etc.
• Let others try it out
• See how other people use it and get feedback.
if there is time...
<? Show some code! ?>
Thank You!
Any Questions?
Site: casabona.org
Slides: casabona.org/wcphilly/
Twitter: @jcasabona
Resources
• WordPress Codex
• Handcrafted CSS
• Simplebits (Dan C’s site)
• ThemeForest
• WPTuts+

More Related Content

What's hot

Test automation with Cucumber-JVM
Test automation with Cucumber-JVMTest automation with Cucumber-JVM
Test automation with Cucumber-JVM
Alan Parkinson
 
Journey To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The MachineJourney To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The Machine
Irfan Maulana
 
This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.
Masaki Komagata
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
Shinichi Nishikawa
 
Big Websites
Big WebsitesBig Websites
Big Websites
Four Kitchens
 
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Bruce Li
 
Day 1 - Intro to Ruby
Day 1 - Intro to RubyDay 1 - Intro to Ruby
Day 1 - Intro to Ruby
Barry Jones
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
Barry Jones
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
Derek Jacoby
 
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)
Bruce Li
 
Why Everyone else writes bad code
Why Everyone else writes bad codeWhy Everyone else writes bad code
Why Everyone else writes bad code
ColdFusionConference
 
Web Cache Deception Attack
Web Cache Deception AttackWeb Cache Deception Attack
Web Cache Deception Attack
Omer Gil
 
Cucumber
CucumberCucumber
Cucumber
Bachue Zhou
 
PropErty based testing
PropErty based testingPropErty based testing
PropErty based testing
enriquepazperez
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
Derek Jacoby
 
Intro to EmberJS
Intro to EmberJSIntro to EmberJS
Intro to EmberJS
Jason Draper
 
Component-first Applications
Component-first ApplicationsComponent-first Applications
Component-first Applications
Miguelangel Fernandez
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, Successfully
Sauce Labs
 
Instagram filters
Instagram filters Instagram filters
Instagram filters
Thinkful
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
Derek Jacoby
 

What's hot (20)

Test automation with Cucumber-JVM
Test automation with Cucumber-JVMTest automation with Cucumber-JVM
Test automation with Cucumber-JVM
 
Journey To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The MachineJourney To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The Machine
 
This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.This is presentation at Mitaka.rb #10.
This is presentation at Mitaka.rb #10.
 
An easy guide to Plugin Development
An easy guide to Plugin DevelopmentAn easy guide to Plugin Development
An easy guide to Plugin Development
 
Big Websites
Big WebsitesBig Websites
Big Websites
 
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
 
Day 1 - Intro to Ruby
Day 1 - Intro to RubyDay 1 - Intro to Ruby
Day 1 - Intro to Ruby
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
 
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)
 
Why Everyone else writes bad code
Why Everyone else writes bad codeWhy Everyone else writes bad code
Why Everyone else writes bad code
 
Web Cache Deception Attack
Web Cache Deception AttackWeb Cache Deception Attack
Web Cache Deception Attack
 
Cucumber
CucumberCucumber
Cucumber
 
PropErty based testing
PropErty based testingPropErty based testing
PropErty based testing
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
 
Intro to EmberJS
Intro to EmberJSIntro to EmberJS
Intro to EmberJS
 
Component-first Applications
Component-first ApplicationsComponent-first Applications
Component-first Applications
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, Successfully
 
Instagram filters
Instagram filters Instagram filters
Instagram filters
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 

Viewers also liked

Where we live 2
Where we live 2Where we live 2
Where we live 2
carrascosaurio
 
Responsive Design with WordPress
Responsive Design with WordPressResponsive Design with WordPress
Responsive Design with WordPress
Joe Casabona
 
Local Development Environments
Local Development EnvironmentsLocal Development Environments
Local Development Environments
Joe Casabona
 
Recipe
RecipeRecipe
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
Joe Casabona
 
My Top WordPress Plugins
My Top WordPress PluginsMy Top WordPress Plugins
My Top WordPress Plugins
Joe Casabona
 
The Dean wants to Make this WordPress Site Responsive
The Dean wants to Make this WordPress Site ResponsiveThe Dean wants to Make this WordPress Site Responsive
The Dean wants to Make this WordPress Site Responsive
Joe Casabona
 
WCCHS: Responsive Design with WordPress
WCCHS: Responsive Design with WordPressWCCHS: Responsive Design with WordPress
WCCHS: Responsive Design with WordPress
Joe Casabona
 
Building Parsec : The Planning Stage
Building Parsec : The Planning StageBuilding Parsec : The Planning Stage
Building Parsec : The Planning Stage
Joe Casabona
 
Reporting questions 1-D
Reporting questions 1-DReporting questions 1-D
Reporting questions 1-D
carrascosaurio
 
мыслители
мыслителимыслители
мыслителиhastiya
 
Connecting Custom Post Types
Connecting Custom Post TypesConnecting Custom Post Types
Connecting Custom Post Types
Joe Casabona
 
Intro to research
Intro to researchIntro to research
Intro to research
Sherfil Kate Jandog
 
Responsive Design with WordPress (WCPHX)
Responsive Design with WordPress (WCPHX)Responsive Design with WordPress (WCPHX)
Responsive Design with WordPress (WCPHX)
Joe Casabona
 
Using PHP to Create a Web Based Mobile Banner Application
Using PHP to Create a Web Based Mobile Banner ApplicationUsing PHP to Create a Web Based Mobile Banner Application
Using PHP to Create a Web Based Mobile Banner Application
Joe Casabona
 
Hacking the Luminis 5 Portal
Hacking the Luminis 5 PortalHacking the Luminis 5 Portal
Hacking the Luminis 5 Portal
Joe Casabona
 
Wearable Technology: The Next Big Thing
Wearable Technology: The Next Big ThingWearable Technology: The Next Big Thing
Wearable Technology: The Next Big Thing
Joe Casabona
 

Viewers also liked (17)

Where we live 2
Where we live 2Where we live 2
Where we live 2
 
Responsive Design with WordPress
Responsive Design with WordPressResponsive Design with WordPress
Responsive Design with WordPress
 
Local Development Environments
Local Development EnvironmentsLocal Development Environments
Local Development Environments
 
Recipe
RecipeRecipe
Recipe
 
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
 
My Top WordPress Plugins
My Top WordPress PluginsMy Top WordPress Plugins
My Top WordPress Plugins
 
The Dean wants to Make this WordPress Site Responsive
The Dean wants to Make this WordPress Site ResponsiveThe Dean wants to Make this WordPress Site Responsive
The Dean wants to Make this WordPress Site Responsive
 
WCCHS: Responsive Design with WordPress
WCCHS: Responsive Design with WordPressWCCHS: Responsive Design with WordPress
WCCHS: Responsive Design with WordPress
 
Building Parsec : The Planning Stage
Building Parsec : The Planning StageBuilding Parsec : The Planning Stage
Building Parsec : The Planning Stage
 
Reporting questions 1-D
Reporting questions 1-DReporting questions 1-D
Reporting questions 1-D
 
мыслители
мыслителимыслители
мыслители
 
Connecting Custom Post Types
Connecting Custom Post TypesConnecting Custom Post Types
Connecting Custom Post Types
 
Intro to research
Intro to researchIntro to research
Intro to research
 
Responsive Design with WordPress (WCPHX)
Responsive Design with WordPress (WCPHX)Responsive Design with WordPress (WCPHX)
Responsive Design with WordPress (WCPHX)
 
Using PHP to Create a Web Based Mobile Banner Application
Using PHP to Create a Web Based Mobile Banner ApplicationUsing PHP to Create a Web Based Mobile Banner Application
Using PHP to Create a Web Based Mobile Banner Application
 
Hacking the Luminis 5 Portal
Hacking the Luminis 5 PortalHacking the Luminis 5 Portal
Hacking the Luminis 5 Portal
 
Wearable Technology: The Next Big Thing
Wearable Technology: The Next Big ThingWearable Technology: The Next Big Thing
Wearable Technology: The Next Big Thing
 

Similar to Building a Simple Theme Framework

11 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 201411 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 2014
WordPressBrisbane
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Mike Schinkel
 
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Mozaic Works
 
Staging and Deployment
Staging and DeploymentStaging and Deployment
Staging and Deployment
heyrocker
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
Taylor Lovett
 
Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016
David Brattoli
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
Acquia
 
Alex Theedom Java ee revisits design patterns
Alex Theedom	Java ee revisits design patternsAlex Theedom	Java ee revisits design patterns
Alex Theedom Java ee revisits design patterns
Аліна Шепшелей
 
SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
Inhacking
 
Alm with tfs 2013
Alm with tfs 2013Alm with tfs 2013
Alm with tfs 2013
MSDEVMTL
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell script
David Cobb
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
reedmaniac
 
presentation
presentationpresentation
presentation
tutorialsruby
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your website
hernanibf
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
Einar Ingebrigtsen
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
Alexander Makarov
 
Drupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 versionDrupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 version
David Lanier
 
Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG)
Mediacurrent
 
Performant Django - Ara Anjargolian
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara Anjargolian
Hakka Labs
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
Jesse Warden
 

Similar to Building a Simple Theme Framework (20)

11 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 201411 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 2014
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
 
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
 
Staging and Deployment
Staging and DeploymentStaging and Deployment
Staging and Deployment
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
 
Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016
 
5 Common Mistakes You are Making on your Website
 5 Common Mistakes You are Making on your Website 5 Common Mistakes You are Making on your Website
5 Common Mistakes You are Making on your Website
 
Alex Theedom Java ee revisits design patterns
Alex Theedom	Java ee revisits design patternsAlex Theedom	Java ee revisits design patterns
Alex Theedom Java ee revisits design patterns
 
SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
 
Alm with tfs 2013
Alm with tfs 2013Alm with tfs 2013
Alm with tfs 2013
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell script
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your website
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
 
Drupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 versionDrupal upgrades and migrations. BAD Camp 2013 version
Drupal upgrades and migrations. BAD Camp 2013 version
 
Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG)
 
Performant Django - Ara Anjargolian
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara Anjargolian
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 

Building a Simple Theme Framework

  • 1. Building a Simple Theme Framework by: Joe Casabona
  • 2. Who am I? • Native of NYS • Yankee Fan • WordPress Developer • Computer Nerd • Star Wars Nerd • Author of BuildingWordPressThemes from Scratch
  • 3. Software Reuse • Some General Principles & Tips
  • 4. Software Reuse • What is it? Creating code that can be used across several projects. Using existing software to create new software. • Why is it Important? • It saves time • It’s easier to test • It allows you to focus on more advanced parts of a project.
  • 5. Principles of Reuse • DesignYour Code • Layout functions, classes, page templates before hand! • Generalize Where Possible • Recognize when you’re reusing code snippets • Document & Test Thoroughly! • Testing will ensure your code works before implementing it 5, 10, or 20 times
  • 6. DefineYour Needs • We all have different needs! • I’ll talk about mine. Keep yours in mind. • EvaluateYour Process • ReviewYour Code • What do you do over and over? • Look for the same code across recent projects!
  • 7. DefineYour Needs (my needs) • Plugable CSS • Constants for Theme & Image URLS • Common WordPress functionality (menus, sidebars, CPTs, etc.) • Most Common theme templates (header, footer, page, index) • Common Folders • Lightweight
  • 8. Now What? • You know what you needs. Now what? • Before you code, see what’s out there! • Can a plugin or other theme fulfill your needs? • Is there already some theme you use as a starting point?
  • 9. What’s Out There (themes) • Thematic • Thesis • Carrington • Genesis • Atahualpa
  • 10. What’s Out There (Plugins) • OptionTree • Custom Post Type UI • Royal Slider • Contact Form 7
  • 11. Building the Framework • What to do, what to do...
  • 12. DesigningYour Code • I noticed I was doing a couple of things over and over • Copy K2 • Rip out stuff I didn't use • Replace it with my standard template • Modify • Eventually, I would just copy the last theme I created • I took my common components and created my framework
  • 13. Ex: Post Attachments ) { setup_postdata($post); the_attachment_link($post->ID, false, false, true); }}} if ($attachments) {foreach ( $attachments as $post ) { setup_postdata($post); the_attachment_link($post->ID, false, false, true); }}} if ($attachments) {foreach ( $attachments as $post ) { setup_postdata($post); the_attachment_link($post->ID, false, false, true); }}} if ($attachments) {foreach ( $attachments as $post ) { setup_postdata($post); the_attachment_link($post->ID, false, false, true); }}} if ($attachments) {foreach ( $attachments as $post ) { setup_postdata($post); the_attachment_link($post->ID, false, false, true); }}} if ($attachments) {foreach ( $attachments as $post
  • 14. Necessary Files • Style.css • Functions.php • Index.php • That’s it! WordPress will fill in the blanks with only these.
  • 15. Recommended Files • All Necessary files • header.php & footer.php • page.php • single.php • A Custom Post Type generator/template • A theme options generator/template • search.php • archive.php • sidebar.php
  • 16. My CSS • Single Sheet • Compressed normalize.css • Some base styles • Standard HTML5 Elements • Basic Navigation CSS • Mobile first approach • Basic Media Queries • Any common classes and IE Fixes
  • 17. My Functions • Constants to use throughout the whole theme: define( 'TEMPPATH', get_bloginfo('stylesheet_directory')); define( 'IMAGES', TEMPPATH. "/images"); • Calls to include: • Nav Menus • Sidebars (2) • Custom functions I use across multiple themes (like attachments function from earlier)
  • 18. Using the Framework • How and When
  • 19. • As a Child Theme: • Cleaner • Easier to update • Can overwrite any page • As a Boilerplate: • One off jobs you don’t plan on updating • Largely customized jobs where you want to reuse only parts of the framework. 2 Ways to Use Framework
  • 20. As a Child Theme • Allows you to create themes that will automatically get updated when you update your framework • Bug Fixes • Additional Functionality • General Theme Updates • Overwrites • No need to hack together/delete. Import and overwrite!
  • 21. As a Boilerplate • Did this for a while! • This project started to serve as a simple boilerplate for me • Use for one-off projects • Projects you won't have control over after initial launch • Projects that will be deeply different structurally
  • 22. Which Should I Use? • Cliche Answer: It Depends! • As with most things in our field, there is no be-all- end-all answer. • Consider the project at hand and make the call there. • Practically speaking, a child theme of your framework will likely work most of the time.
  • 23. Some Tips • Test it thoroughly • You will use this a lot, so make sure things work as expected across multiple browsers • Improve and update it • As you grow as a developer, your needs will change. Make sure your framework changes with you.
  • 24. Some Tips (cont) • Don't get complacent • Do let your growth stagnate because you're using a framework. • Stay up on new features, best practices, etc. • Let others try it out • See how other people use it and get feedback.
  • 25. if there is time... <? Show some code! ?>
  • 26. Thank You! Any Questions? Site: casabona.org Slides: casabona.org/wcphilly/ Twitter: @jcasabona
  • 27. Resources • WordPress Codex • Handcrafted CSS • Simplebits (Dan C’s site) • ThemeForest • WPTuts+