SlideShare une entreprise Scribd logo
1  sur  27
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+

Contenu connexe

Tendances

Test automation with Cucumber-JVM
Test automation with Cucumber-JVMTest automation with Cucumber-JVM
Test automation with Cucumber-JVMAlan 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 MachineIrfan 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 DevelopmentShinichi Nishikawa
 
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 RubyBarry Jones
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4Derek Jacoby
 
Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Refactoring Workshop (Rails Pacific 2014)
Refactoring Workshop (Rails Pacific 2014)Bruce Li
 
Web Cache Deception Attack
Web Cache Deception AttackWeb Cache Deception Attack
Web Cache Deception AttackOmer Gil
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Derek Jacoby
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, SuccessfullySauce Labs
 
Instagram filters
Instagram filters Instagram filters
Instagram filters Thinkful
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11Derek Jacoby
 

Tendances (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
 

En vedette

Responsive Design with WordPress
Responsive Design with WordPressResponsive Design with WordPress
Responsive Design with WordPressJoe Casabona
 
Local Development Environments
Local Development EnvironmentsLocal Development Environments
Local Development EnvironmentsJoe Casabona
 
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and SecurityJoe Casabona
 
My Top WordPress Plugins
My Top WordPress PluginsMy Top WordPress Plugins
My Top WordPress PluginsJoe 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 ResponsiveJoe Casabona
 
WCCHS: Responsive Design with WordPress
WCCHS: Responsive Design with WordPressWCCHS: Responsive Design with WordPress
WCCHS: Responsive Design with WordPressJoe Casabona
 
Building Parsec : The Planning Stage
Building Parsec : The Planning StageBuilding Parsec : The Planning Stage
Building Parsec : The Planning StageJoe Casabona
 
Reporting questions 1-D
Reporting questions 1-DReporting questions 1-D
Reporting questions 1-Dcarrascosaurio
 
мыслители
мыслителимыслители
мыслителиhastiya
 
Connecting Custom Post Types
Connecting Custom Post TypesConnecting Custom Post Types
Connecting Custom Post TypesJoe Casabona
 
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 ApplicationJoe Casabona
 
Hacking the Luminis 5 Portal
Hacking the Luminis 5 PortalHacking the Luminis 5 Portal
Hacking the Luminis 5 PortalJoe Casabona
 
Wearable Technology: The Next Big Thing
Wearable Technology: The Next Big ThingWearable Technology: The Next Big Thing
Wearable Technology: The Next Big ThingJoe Casabona
 

En vedette (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
 

Similaire à 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 2014WordPressBrisbane
 
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 Deploymentheyrocker
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsTaylor Lovett
 
Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016Responsive themeworkshop wcneo2016
Responsive themeworkshop wcneo2016David 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 WebsiteAcquia
 
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 2013MSDEVMTL
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell scriptDavid 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 Dutyreedmaniac
 
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 websitehernanibf
 
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 developmentEinar 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 developedAlexander 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 versionDavid 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 AnjargolianHakka Labs
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 

Similaire à 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
 
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"
 
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
 
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
 

Dernier

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Dernier (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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+