SlideShare a Scribd company logo
1 of 30
Where to Find Me
•brian@upthemes.com
•Twitter: brianfegter
•github: inspectorfegter
•The Interwebz: coderrr.com
About Me
•Live near Orlando, Florida
  (Titusville = the booming metropolis)
•Hobbies: photography, fountain
  pens, planking (not)
•I work for UpThemes.com and
  LiftUX.com as a lead developer
•Favorite vegetable: popcorn
The Anatomy of a
  Commercial
   Wordpress
     Theme

 A Developmental Overview
The TRUTH about
 commercial themes...

•There is not a single theme that does
  not require support. You must build
  a support system.
•Rarely does a purchased theme
  remain in its original condition.
•A strong percentage of buyers are
  international.
Ground Zero

           SOLID
           Template
          Architecture

http://codex.wordpress.org/Theme_Development
On your mark, get set...STOP


  Understand Template
      Hierarchy


 http://codex.wordpress.org/Template_Hierarchy
Hierarchy Diagram




http://codex.wordpress.org/Template_Hierarchy
Template Structure
       CREDO
            I pledge to:
•Follow template hierarchy patterns
•Clearly name my supporting files/folders
•Never, never, ever, NEVER, ever nest a
  plugin inside my theme
•Clarity over cleverness
Using Wordpress Assets
 •Clearly name your sidebars
 •Use custom post types only when
   necessary

 •Define theme locations for menus
 •Localize your strings - __() _e() are your
   friends

 •Set WP image sizes vs. image resizing
   scripts (TimThumb, etc...)

 •Leverage the power of CSS with
   body_class() and post_class()
To use or
not to use
 Theme
Options...
Our Options Framework




github.com/chriswallace/UpThemes-Framework
Painless Option Creation
Bodacious Functionality
Stupid-Easy
   Implementation

•Include one file in functions.php
  require_once(‘admin/admin.php’);
•Call global $up_options;
•Retrieve your option value by ID
  $up_options->my_awesome_id
Theme Options
     User Health Alert!

•Too many options kill brain cells and
  raise blood pressure.
•No options make users MAD and
  could lead to permanent psychosis.
•Obscure options cause road rage and
  have been linked to chronic multiple-
  punctuationitis!!!!!!!!!!!!!
Code is Poetry
•Code is Narrative.
•Your theme tells a story and has an
  intended plot, characters, scenes,
  movements, etc...
•The back-end code (script) should
  clearly narrate the story of the
  front-end display.
•Clean code leverages the power of
  the brain to quickly identify and
  associate words and phrases with
Naming Stuff
•The sole purpose of names in code is to
  reveal the intent of the author.
•Choosing the right names can make or
  break future scalability.
•Bad names generate support requests.
•Obscure names destroy narrative.
•Avoid cultural references and slang.
•Good names make everyone happy.
Clean Functions
• Functions should do one thing and be short.
• Function names should be semantic and contain a
  verb.

• Functions need a namespace in WP plugins/
  themes.
  foo_bar(){} vs. prefix_foo_bar(){}

• Long function names are always better than short
  obscure names.

  BAD: addfavclr($u, $c)
  GOOD: add_favorite_color($user_id, $color)

• The name of the function must clearly reveal the
  intent of the function.
Clean Variables
•Variable names define the context of a
  function. A clearly defined function can
  be obfuscated by obscure variable
  names.

•Obscure variable names confuse others
  who edit your code later.
  $u vs. $user_id

•With proper naming, a function should
  read like a paragraph.

•Loop counters are an exception as long
  as their scope is limited. (i.e. $i++)
Clean Commenting
•If it’s necessary to comment about how
  a function works, your code stinketh.

•PHP comments should be used for
  attribution, licensing, phpdoc (for
  generating php-xref, IDE support,
  etc...), directing users to other files/
  layers/plugins.

•Comments quickly become obsolete
  with updates/upgrades.

• Descriptive HTML comments are a no-
  no unless required for attribution.
Clean Formatting
•Keep sibling functions in proximity.
•Indent your code properly to clearly
   show nested expressions.
•Follow Wordpress code/style standards.
•Do it. Now.

http://codex.wordpress.org/WordPress_Coding_Standards
Duplication
•Learn Wordpress functionality so
  you don’t create a duplicate function.
 •global $is_lynx, $is_gecko, $is_IE, $is_opera,
  Browser Detection:
   $is_NS4, $is_safari, $is_chrome, $is_iphone;

 •add_filter(‘the_content’, ‘my_function’);
  Global Content Filtering

•Duplication adds server overhead
  and user frustration.
Shortcode Fever
•Shortcodes here, shortcodes there...
  buttons, sliders, TABS, PRICE
  TABLES, LIST ICONS,
  Testimonials,
  DROPCAPS,
  QUOTES OMG
  YAY!!!!!!!
The Shortcode
     Problem
•A user inserts your theme
  shortcodes throughout their content.
•Said user decides to switch themes.
•Shortcodes no longer function and
  create loads of work.
•User loses mind.
The Shortcode Cure
•Stop being proprietary with your
  theme bling.
•Put your shortcodes in a sweet
  plugin.
•Use your new plugin as a loss-leader
  promotion.
Dirty Code Example




     •This can be found in WP Core
•Wordpress core contains a <blink>
  tag. Dead Serious!!! Where is it
  located?
•Where can you find the Wordpress
 Easter Egg?
Thank You!




        Brian Fegter
       @brianfegter
brian@upthemes.com

More Related Content

What's hot

Creating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsCreating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsAmanda Giles
 
Epub in the wild
Epub in the wildEpub in the wild
Epub in the wildliz_castro
 
#eprdctn tools & tips round up
#eprdctn tools & tips round up#eprdctn tools & tips round up
#eprdctn tools & tips round upBookNet Canada
 
Open Standards in the Walled Garden
Open Standards in the Walled GardenOpen Standards in the Walled Garden
Open Standards in the Walled Gardendigitalbindery
 
Achieving Beautiful Typography in eBooks
Achieving Beautiful Typography in eBooksAchieving Beautiful Typography in eBooks
Achieving Beautiful Typography in eBooksdigitalbindery
 
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody HelgesonWordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody HelgesonCody Helgeson
 
Digital Publishing PDXDMC
Digital Publishing PDXDMCDigital Publishing PDXDMC
Digital Publishing PDXDMCdigitalbindery
 
Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...Chris Charlton
 
Perfect Styling - How to write better CSS
Perfect Styling - How to write better CSSPerfect Styling - How to write better CSS
Perfect Styling - How to write better CSSArtem Tabalin
 
Prototyping Accessibility: Booster 2019
Prototyping Accessibility: Booster 2019Prototyping Accessibility: Booster 2019
Prototyping Accessibility: Booster 2019Adrian Roselli
 
The Role of Design in Accessibility — a11yTO Meet-up
The Role of Design in Accessibility — a11yTO Meet-upThe Role of Design in Accessibility — a11yTO Meet-up
The Role of Design in Accessibility — a11yTO Meet-upAdrian Roselli
 
Creative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS BasicsCreative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS BasicsLukas Oppermann
 
Getting the Most from Xamarin Studio - Michael Hutchinson
Getting the Most from Xamarin Studio - Michael HutchinsonGetting the Most from Xamarin Studio - Michael Hutchinson
Getting the Most from Xamarin Studio - Michael HutchinsonXamarin
 
SPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsSPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsMark Rackley
 
Getting Started With WordPress Themes for Beginners
Getting Started With WordPress Themes for BeginnersGetting Started With WordPress Themes for Beginners
Getting Started With WordPress Themes for BeginnersNew Tricks
 

What's hot (20)

Creating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable NeedsCreating Customizable Widgets for Unpredictable Needs
Creating Customizable Widgets for Unpredictable Needs
 
Epub in the wild
Epub in the wildEpub in the wild
Epub in the wild
 
#eprdctn tools & tips round up
#eprdctn tools & tips round up#eprdctn tools & tips round up
#eprdctn tools & tips round up
 
Remodel your website
Remodel your websiteRemodel your website
Remodel your website
 
Open Standards in the Walled Garden
Open Standards in the Walled GardenOpen Standards in the Walled Garden
Open Standards in the Walled Garden
 
Achieving Beautiful Typography in eBooks
Achieving Beautiful Typography in eBooksAchieving Beautiful Typography in eBooks
Achieving Beautiful Typography in eBooks
 
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody HelgesonWordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
Wordcamp Phoenix 2012 - Custom Post Types: Now What? By Cody Helgeson
 
Digital Publishing PDXDMC
Digital Publishing PDXDMCDigital Publishing PDXDMC
Digital Publishing PDXDMC
 
Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...
 
Perfect Styling - How to write better CSS
Perfect Styling - How to write better CSSPerfect Styling - How to write better CSS
Perfect Styling - How to write better CSS
 
Ebook bootcamp
Ebook bootcampEbook bootcamp
Ebook bootcamp
 
Prototyping Accessibility: Booster 2019
Prototyping Accessibility: Booster 2019Prototyping Accessibility: Booster 2019
Prototyping Accessibility: Booster 2019
 
The Role of Design in Accessibility — a11yTO Meet-up
The Role of Design in Accessibility — a11yTO Meet-upThe Role of Design in Accessibility — a11yTO Meet-up
The Role of Design in Accessibility — a11yTO Meet-up
 
Creative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS BasicsCreative Web 02 - HTML & CSS Basics
Creative Web 02 - HTML & CSS Basics
 
OOP CSS Presenation
OOP CSS PresenationOOP CSS Presenation
OOP CSS Presenation
 
CSS for Mobile
CSS for MobileCSS for Mobile
CSS for Mobile
 
Getting the Most from Xamarin Studio - Michael Hutchinson
Getting the Most from Xamarin Studio - Michael HutchinsonGetting the Most from Xamarin Studio - Michael Hutchinson
Getting the Most from Xamarin Studio - Michael Hutchinson
 
SPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsSPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery Essentials
 
Getting Started With WordPress Themes for Beginners
Getting Started With WordPress Themes for BeginnersGetting Started With WordPress Themes for Beginners
Getting Started With WordPress Themes for Beginners
 
Down and Dirty EPUB 3
Down and Dirty EPUB 3Down and Dirty EPUB 3
Down and Dirty EPUB 3
 

Viewers also liked

Проблемы долговременного хранения действующих и исторических документов, по...
Проблемы долговременного хранения действующих  и исторических документов,  по...Проблемы долговременного хранения действующих  и исторических документов,  по...
Проблемы долговременного хранения действующих и исторических документов, по...Natasha Khramtsovsky
 
Так ли уж проста эта простая электронная подпись
Так ли уж проста эта простая электронная подписьТак ли уж проста эта простая электронная подпись
Так ли уж проста эта простая электронная подписьNatasha Khramtsovsky
 
PROEXPOSURE Brazil: going back home
PROEXPOSURE Brazil: going back homePROEXPOSURE Brazil: going back home
PROEXPOSURE Brazil: going back homePROEXPOSURE CIC
 
СЭД: Новые задачи, новые проблемы, новые стандарты
СЭД: Новые задачи, новые проблемы, новые стандартыСЭД: Новые задачи, новые проблемы, новые стандарты
СЭД: Новые задачи, новые проблемы, новые стандартыNatasha Khramtsovsky
 
Shopping Cart Software for SEO
Shopping Cart Software for SEOShopping Cart Software for SEO
Shopping Cart Software for SEOE-Web Marketing
 
Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...Natasha Khramtsovsky
 
PROEXPOSURE Communications Training Courses
PROEXPOSURE Communications Training Courses PROEXPOSURE Communications Training Courses
PROEXPOSURE Communications Training Courses PROEXPOSURE CIC
 
Текущие проблемы в области законодательного регулирования управления документ...
Текущие проблемы в области законодательного регулирования управления документ...Текущие проблемы в области законодательного регулирования управления документ...
Текущие проблемы в области законодательного регулирования управления документ...Natasha Khramtsovsky
 
Консультационные услуги сегодня и завтра
Консультационные услуги  сегодня и завтраКонсультационные услуги  сегодня и завтра
Консультационные услуги сегодня и завтраNatasha Khramtsovsky
 
Asp.net 5 en linux , herramientas e integración
Asp.net 5 en linux , herramientas e integraciónAsp.net 5 en linux , herramientas e integración
Asp.net 5 en linux , herramientas e integraciónrobertogg
 
д-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES Trust
д-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES Trustд-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES Trust
д-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES TrustNatasha Khramtsovsky
 
มาเขียนโค้ดแย่ๆ กันเถอะ
มาเขียนโค้ดแย่ๆ กันเถอะมาเขียนโค้ดแย่ๆ กันเถอะ
มาเขียนโค้ดแย่ๆ กันเถอะSomkiat Puisungnoen
 
Джованни Сено - Законодательно-нормативная база и использование электронных д...
Джованни Сено - Законодательно-нормативная база и использование электронных д...Джованни Сено - Законодательно-нормативная база и использование электронных д...
Джованни Сено - Законодательно-нормативная база и использование электронных д...Natasha Khramtsovsky
 

Viewers also liked (20)

Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
Проблемы долговременного хранения действующих и исторических документов, по...
Проблемы долговременного хранения действующих  и исторических документов,  по...Проблемы долговременного хранения действующих  и исторических документов,  по...
Проблемы долговременного хранения действующих и исторических документов, по...
 
Introductie positie in de geschiedenis
Introductie positie in de geschiedenisIntroductie positie in de geschiedenis
Introductie positie in de geschiedenis
 
Так ли уж проста эта простая электронная подпись
Так ли уж проста эта простая электронная подписьТак ли уж проста эта простая электронная подпись
Так ли уж проста эта простая электронная подпись
 
PROEXPOSURE Brazil: going back home
PROEXPOSURE Brazil: going back homePROEXPOSURE Brazil: going back home
PROEXPOSURE Brazil: going back home
 
СЭД: Новые задачи, новые проблемы, новые стандарты
СЭД: Новые задачи, новые проблемы, новые стандартыСЭД: Новые задачи, новые проблемы, новые стандарты
СЭД: Новые задачи, новые проблемы, новые стандарты
 
Shopping Cart Software for SEO
Shopping Cart Software for SEOShopping Cart Software for SEO
Shopping Cart Software for SEO
 
Okra - Ik vinde de aarde leuk!
Okra - Ik  vinde de aarde leuk!Okra - Ik  vinde de aarde leuk!
Okra - Ik vinde de aarde leuk!
 
Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...Отечественная и зарубежная законодательная и нормативная база организации вне...
Отечественная и зарубежная законодательная и нормативная база организации вне...
 
PROEXPOSURE Communications Training Courses
PROEXPOSURE Communications Training Courses PROEXPOSURE Communications Training Courses
PROEXPOSURE Communications Training Courses
 
Economics 1 1
Economics 1 1Economics 1 1
Economics 1 1
 
Текущие проблемы в области законодательного регулирования управления документ...
Текущие проблемы в области законодательного регулирования управления документ...Текущие проблемы в области законодательного регулирования управления документ...
Текущие проблемы в области законодательного регулирования управления документ...
 
Консультационные услуги сегодня и завтра
Консультационные услуги  сегодня и завтраКонсультационные услуги  сегодня и завтра
Консультационные услуги сегодня и завтра
 
Asp.net 5 en linux , herramientas e integración
Asp.net 5 en linux , herramientas e integraciónAsp.net 5 en linux , herramientas e integración
Asp.net 5 en linux , herramientas e integración
 
De Koep (Jef Van Eyck)
De Koep (Jef Van Eyck)De Koep (Jef Van Eyck)
De Koep (Jef Van Eyck)
 
д-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES Trust
д-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES Trustд-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES Trust
д-р Лючиана Дюранти – Дополнение к презентации о проекте InterPARES Trust
 
Ontwikkelen van een integriteitsbeleid (Heidi Paesen)
Ontwikkelen van een integriteitsbeleid (Heidi Paesen)Ontwikkelen van een integriteitsbeleid (Heidi Paesen)
Ontwikkelen van een integriteitsbeleid (Heidi Paesen)
 
มาเขียนโค้ดแย่ๆ กันเถอะ
มาเขียนโค้ดแย่ๆ กันเถอะมาเขียนโค้ดแย่ๆ กันเถอะ
มาเขียนโค้ดแย่ๆ กันเถอะ
 
Workshop sociusonderzoek
Workshop sociusonderzoekWorkshop sociusonderzoek
Workshop sociusonderzoek
 
Джованни Сено - Законодательно-нормативная база и использование электронных д...
Джованни Сено - Законодательно-нормативная база и использование электронных д...Джованни Сено - Законодательно-нормативная база и использование электронных д...
Джованни Сено - Законодательно-нормативная база и использование электронных д...
 

Similar to Wordcamp St. Louis - Clean Coding

WordPress: A Designer's CMS
WordPress: A Designer's CMSWordPress: A Designer's CMS
WordPress: A Designer's CMSChelsea Otakan
 
Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Mediacurrent
 
WordPress Theming Best Practices
WordPress Theming Best PracticesWordPress Theming Best Practices
WordPress Theming Best PracticesBrian Krogsgard
 
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 DutyLeslie Doherty
 
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
 
WordPress Themes and Plugins
WordPress Themes and PluginsWordPress Themes and Plugins
WordPress Themes and Pluginssuperann
 
NEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & SecurityNEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & SecurityMichelle Davies (Hryvnak)
 
WordPress Intermediate Workshop
WordPress Intermediate WorkshopWordPress Intermediate Workshop
WordPress Intermediate WorkshopThe Toolbox, Inc.
 
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and SecurityJoe Casabona
 
Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Adrian Roselli
 
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
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012Stephanie Leary
 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystemsRuben Goncalves
 
WordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenWordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenHeidi Cool
 
Most widely used WordPress tips and tricks of 2016
Most widely used WordPress tips and tricks of 2016Most widely used WordPress tips and tricks of 2016
Most widely used WordPress tips and tricks of 2016Reegan
 
Building a Simple Theme Framework
Building a Simple Theme FrameworkBuilding a Simple Theme Framework
Building a Simple Theme FrameworkJoe Casabona
 

Similar to Wordcamp St. Louis - Clean Coding (20)

WordPress: A Designer's CMS
WordPress: A Designer's CMSWordPress: A Designer's CMS
WordPress: A Designer's CMS
 
Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG)
 
WordPress Theming Best Practices
WordPress Theming Best PracticesWordPress Theming Best Practices
WordPress Theming Best Practices
 
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
 
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
 
WordPress Themes and Plugins
WordPress Themes and PluginsWordPress Themes and Plugins
WordPress Themes and Plugins
 
NEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & SecurityNEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & Security
 
WordPress Intermediate Workshop
WordPress Intermediate WorkshopWordPress Intermediate Workshop
WordPress Intermediate Workshop
 
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
 
Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014
 
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
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012
 
Wp 3hr-course
Wp 3hr-courseWp 3hr-course
Wp 3hr-course
 
CSS workshop @ OutSystems
CSS workshop @ OutSystemsCSS workshop @ OutSystems
CSS workshop @ OutSystems
 
Design Without Types
Design Without TypesDesign Without Types
Design Without Types
 
WordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-BetweenWordPress A CMS for Beginners, Geeks and Those In-Between
WordPress A CMS for Beginners, Geeks and Those In-Between
 
Most widely used WordPress tips and tricks of 2016
Most widely used WordPress tips and tricks of 2016Most widely used WordPress tips and tricks of 2016
Most widely used WordPress tips and tricks of 2016
 
Building a Simple Theme Framework
Building a Simple Theme FrameworkBuilding a Simple Theme Framework
Building a Simple Theme Framework
 

Recently uploaded

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Wordcamp St. Louis - Clean Coding

  • 1.
  • 2. Where to Find Me •brian@upthemes.com •Twitter: brianfegter •github: inspectorfegter •The Interwebz: coderrr.com
  • 3. About Me •Live near Orlando, Florida (Titusville = the booming metropolis) •Hobbies: photography, fountain pens, planking (not) •I work for UpThemes.com and LiftUX.com as a lead developer •Favorite vegetable: popcorn
  • 4. The Anatomy of a Commercial Wordpress Theme A Developmental Overview
  • 5. The TRUTH about commercial themes... •There is not a single theme that does not require support. You must build a support system. •Rarely does a purchased theme remain in its original condition. •A strong percentage of buyers are international.
  • 6. Ground Zero SOLID Template Architecture http://codex.wordpress.org/Theme_Development
  • 7. On your mark, get set...STOP Understand Template Hierarchy http://codex.wordpress.org/Template_Hierarchy
  • 9. Template Structure CREDO I pledge to: •Follow template hierarchy patterns •Clearly name my supporting files/folders •Never, never, ever, NEVER, ever nest a plugin inside my theme •Clarity over cleverness
  • 10. Using Wordpress Assets •Clearly name your sidebars •Use custom post types only when necessary •Define theme locations for menus •Localize your strings - __() _e() are your friends •Set WP image sizes vs. image resizing scripts (TimThumb, etc...) •Leverage the power of CSS with body_class() and post_class()
  • 11. To use or not to use Theme Options...
  • 15. Stupid-Easy Implementation •Include one file in functions.php require_once(‘admin/admin.php’); •Call global $up_options; •Retrieve your option value by ID $up_options->my_awesome_id
  • 16. Theme Options User Health Alert! •Too many options kill brain cells and raise blood pressure. •No options make users MAD and could lead to permanent psychosis. •Obscure options cause road rage and have been linked to chronic multiple- punctuationitis!!!!!!!!!!!!!
  • 17. Code is Poetry •Code is Narrative. •Your theme tells a story and has an intended plot, characters, scenes, movements, etc... •The back-end code (script) should clearly narrate the story of the front-end display. •Clean code leverages the power of the brain to quickly identify and associate words and phrases with
  • 18. Naming Stuff •The sole purpose of names in code is to reveal the intent of the author. •Choosing the right names can make or break future scalability. •Bad names generate support requests. •Obscure names destroy narrative. •Avoid cultural references and slang. •Good names make everyone happy.
  • 19. Clean Functions • Functions should do one thing and be short. • Function names should be semantic and contain a verb. • Functions need a namespace in WP plugins/ themes. foo_bar(){} vs. prefix_foo_bar(){} • Long function names are always better than short obscure names. BAD: addfavclr($u, $c) GOOD: add_favorite_color($user_id, $color) • The name of the function must clearly reveal the intent of the function.
  • 20. Clean Variables •Variable names define the context of a function. A clearly defined function can be obfuscated by obscure variable names. •Obscure variable names confuse others who edit your code later. $u vs. $user_id •With proper naming, a function should read like a paragraph. •Loop counters are an exception as long as their scope is limited. (i.e. $i++)
  • 21. Clean Commenting •If it’s necessary to comment about how a function works, your code stinketh. •PHP comments should be used for attribution, licensing, phpdoc (for generating php-xref, IDE support, etc...), directing users to other files/ layers/plugins. •Comments quickly become obsolete with updates/upgrades. • Descriptive HTML comments are a no- no unless required for attribution.
  • 22. Clean Formatting •Keep sibling functions in proximity. •Indent your code properly to clearly show nested expressions. •Follow Wordpress code/style standards. •Do it. Now. http://codex.wordpress.org/WordPress_Coding_Standards
  • 23. Duplication •Learn Wordpress functionality so you don’t create a duplicate function. •global $is_lynx, $is_gecko, $is_IE, $is_opera, Browser Detection: $is_NS4, $is_safari, $is_chrome, $is_iphone; •add_filter(‘the_content’, ‘my_function’); Global Content Filtering •Duplication adds server overhead and user frustration.
  • 24. Shortcode Fever •Shortcodes here, shortcodes there... buttons, sliders, TABS, PRICE TABLES, LIST ICONS, Testimonials, DROPCAPS, QUOTES OMG YAY!!!!!!!
  • 25. The Shortcode Problem •A user inserts your theme shortcodes throughout their content. •Said user decides to switch themes. •Shortcodes no longer function and create loads of work. •User loses mind.
  • 26. The Shortcode Cure •Stop being proprietary with your theme bling. •Put your shortcodes in a sweet plugin. •Use your new plugin as a loss-leader promotion.
  • 27. Dirty Code Example •This can be found in WP Core
  • 28. •Wordpress core contains a <blink> tag. Dead Serious!!! Where is it located?
  • 29. •Where can you find the Wordpress Easter Egg?
  • 30. Thank You! Brian Fegter @brianfegter brian@upthemes.com

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n