SlideShare une entreprise Scribd logo
1  sur  71
Télécharger pour lire hors ligne
WordPress Development Paradigms, Idiosyncrasies and Other Big Words Tom Auger, Zeitguys inc. WordCamp Montreal, 2011
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object]
Surprising Learning Curve ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The biggest challenge... ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Meh. ,[object Object],[object Object]
DIY Approach = Low Level ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Bad News ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example: Adding <p> to content ,[object Object],$posts = get_posts(array( 'post_type' => 'my-custom-type' )); foreach($posts as $post){ echo '<div>'; echo $post->post_content; echo '<div>'; }
Option 1: Manually Wrap ,[object Object],$posts = get_posts(array( 'post_type' => 'my-custom-type' )); foreach($posts as $post){ echo '<div>'; echo '<p>'.$post->post_content.'</p>; echo '<div>'; }
Option 1b: RegEx ,[object Object],$blockElements = implode(&quot;|&quot;, array('ADDRESS','BLOCKQUOTE','CENTER','DIR','DIV','DL', etc...); $added_p = preg_replace( '/(?:*<('.$blockElements.')(?:+[^>]+*)*>*(.+?)*<>(?:||$)*)|(?:*(.+?)*(?:||$|(?=<(?:'.$blockElements.')>))+)/is','<p$1>$2$3<p>', $post->post_content);
But wait... doesn't WP already do this? ,[object Object],foreach($posts as $post){ echo '<div>'; echo  wpautop($post->post_content); echo '<div>'; }
So what about the_content()? ,[object Object],foreach($posts as $post){ setup_postdata($post); echo '<div>'; the_content(); echo '<div>'; } wp_reset_postdata();
So how does the_content() do it? ,[object Object],[object Object],function the_content($more_link_text = null, $stripteaser = 0) { $content = get_the_content($more_link_text, $stripteaser); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]&gt;', $content); echo $content; }
Keep following the White Rabbit ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
I want all that other good stuff, too! ,[object Object],foreach($posts as $post){ echo '<div>'; echo apply_filters( 'the_content',  $page->post_content );   echo '<div>'; }
The lesson thus far ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
Big Words ,[object Object],[object Object],[object Object]
WordPress Paradigms and Patterns ,[object Object],[object Object],[object Object],[object Object]
WordPress Idioms ,[object Object],[object Object]
WordPress Idiosyncrasies ,[object Object],[object Object],[object Object],[object Object],[object Object]
Paradigm: Plugins ,[object Object],[object Object],[object Object],<?php  /* Plugin Name: Name Of The Plugin */ ?>
Paradigm: Themes and Templates
Themes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Child Themes ,[object Object],[object Object],[object Object],%> wp-content/themes/my-child-theme/style.css /* Theme Name: Twenty Ten Child Theme Template: twentyten */ @import url('../twentyten/style.css');
Template Files ,[object Object],[object Object],[object Object]
 
Template Parts ,[object Object],[object Object],[object Object],[object Object],[object Object],include(locate_template('template-part')); get_template_part('template', 'part');
Page Templates ,[object Object],<?php /* Template Name: 3 Column */ ?>
Post Formats ,[object Object],[object Object],[object Object],<?php  get_template_part( 'format', get_post_format()); ?>
Paradigm: Hooks, Actions and Filters
[object Object],[object Object]
Hooks ,[object Object],[object Object],[object Object],[object Object]
Actions vs. Filters ,[object Object],[object Object],// set up action hook do_action('hook-name');  // set up filter hook $variable = apply_filters('filter-name', $variable);
Leveraging Action Hooks ,[object Object],[object Object],add_action('init', 'stuff_to_do_at_init');
General Execution Order ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request
Action examples add_action('init', 'register_my_custom_post');   add_action('init', 'register_my_custom_taxonomy');   add_action('widgets_init', 'register_my_widget');   add_action('wp_enqueue_scripts', 'add_my_js_libs');   add_action('save_post', 'save_my_custom_meta');
Leveraging Filter Hooks ,[object Object],add_filter('the_content', 'change_content');  function change_content($content){ $content = 'All your base are belong to us!!!'; return $content; }
Priority and Parameters ,[object Object],add_filter('contextual_help', 'my_help', 10, 3); function my_help($text, $screen_id, $screen){ if ($screen_id == 'edit-my_custom_post_type'){ $text = '<p>You are on your own pal</p>'; } return $text; }
Filter Examples add_filter( 'excerpt_more', 'custom_more' ); add_filter( 'excerpt_length', 'my_length', 999 ); function my_length($length){ return 6; // six is average, right? }
Existing Filters and Actions ,[object Object],[object Object],[object Object],[object Object]
So How Do I Find Them? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Good Citizenship ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Idiom: The Loop and The Query
Getting Your Content: &quot;The Loop&quot; ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Secondary Loops ,[object Object],[object Object],[object Object],[object Object],[object Object]
Suspicious Stuff ,[object Object],[object Object],[object Object],$the_query = new WP_Query( $args ); while ( $the_query->have_posts() ){  $the_query->the_post(); the_title(); } wp_reset_postdata();
Template Tags and get_ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Template Tag vs. get_ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Idiosyncrasy: $wpdb
wpdb Class ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example: Events ,[object Object],[object Object],[object Object],[object Object]
Pure SQL select * from wp_posts join wp_term_relationships on ID = object_id join wp_term_taxonomy on wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id and taxonomy = 'event-type' join wp_terms on wp_term_taxonomy.term_id = wp_terms.term_id and wp_terms.slug = 'speaking' join wp_postmeta on wp_postmeta.post_id = ID and meta_key = 'event-date' and meta_value = '2011-07-09' where post_type = 'event' and post_status = 'published'
More Properer SQL select * from wp_posts  as P join wp_term_relationships  TR_EVENT on  P .ID =  TR_EVENT .object_id join wp_term_taxonomy  TT_EVENT on  TT_EVENT .term_taxonomy_id = TR_EVENT .term_taxonomy_id TT_EVENT .taxonomy = 'event-type' join wp_terms  T_EVENT on  TT_EVENT .term_id =  T_EVENT .term_id and  T_EVENT .slug = 'speaking' join wp_postmeta  M_DATE on  M_DATE .post_id = P.ID and  M_DATE .meta_key = 'event-date' and  M_DATE .meta_value = '2011-07-09' where P .post_type = 'event' and  P .post_status = 'published'
Don't Use Table Names! select * from  {$wpdb->posts}  P join  {$wpdb->term_relationships}  TR_EVENT on P.ID = TR_EVENT.object_id join  {$wpdb->term_taxonomy}  TT_EVENT on TT_EVENT.term_taxonomy_id = TR_EVENT.term_taxonomy_id TT_EVENT.taxonomy = 'event-type' join  {$wpdb->terms}  T_EVENT on TT_EVENT.term_id =T_EVENT.term_id and T_EVENT.slug = 'speaking' join  {$wpdb->postmeta}  M_DATE on M_DATE.post_id = P.ID and M_DATE.meta_key = 'event-date' and M_DATE.meta_value = '2011-07-09' where P.post_type = 'event' and P.post_status = 'published'
More Saferer Query $wpdb->prepare (&quot;select * from {$wpdb->posts} P join {$wpdb->term_relationships} TR_EVENT on P.ID = TR_EVENT.object_id join {$wpdb->term_taxonomy} TT_EVENT on TT_EVENT.term_taxonomy_id = TR_EVENT.term_taxonomy_id TT_EVENT.taxonomy = 'event-type' join {$wpdb->terms} T_EVENT on TT_EVENT.term_id =T_EVENT.term_id and T_EVENT.slug =  %s join {$wpdb->postmeta} M_DATE on M_DATE.post_id = P.ID and M_DATE.meta_key = 'event-date' and M_DATE.meta_value =  %s where P.post_type = 'event' and P.post_status = 'published'&quot;, 'speaking', '2011-07-09' );
But, Whenever We Can... get_posts(array( 'post_type' => 'event', 'tax_query' => array(array( 'taxonomy' => 'event-type', 'field' => 'slug' 'terms' => 'speaking' )), 'meta_query' => array(array( 'key' => 'event-date', 'value' => $todays_date )) ));
Use Built-Ins Whenever You Can ,[object Object],[object Object],[object Object],[object Object],[object Object]
Idiosyncrasy: wp_enqueue_script
We Love jQuery ,[object Object],[object Object],[object Object],[object Object],[object Object]
Enqueue = The Canadian Way, eh? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
No One Likes Conflict ,[object Object],jQuery(document).ready(function($) { $('#mydiv').css({color:'red', border:'2px solid red'}); }); (function($) { var test = &quot;hello, world!&quot;; function testMe(){ alert(test); } $(document).ready(testMe); })(jQuery);
Resources and Forums ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Thanks! www.tomauger.com www.zeitguys.com @TomAuger
Other Stuff for more time
Paradigm: Post Types and Taxonomies
Posts ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Taxonomies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What About Meta? ,[object Object],[object Object],[object Object]
Custom Post vs. Custom Tax ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Custom Post vs. Custom Tax ,[object Object],[object Object],[object Object],[object Object],[object Object]

Contenu connexe

Tendances

jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009Ralph Whitbeck
 
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardJAX London
 
JD17NL Joomla! Overrides and alternate layouts
JD17NL Joomla! Overrides and alternate layoutsJD17NL Joomla! Overrides and alternate layouts
JD17NL Joomla! Overrides and alternate layoutsHans Kuijpers
 
Creating GUI Component APIs in Angular and Web Components
Creating GUI Component APIs in Angular and Web ComponentsCreating GUI Component APIs in Angular and Web Components
Creating GUI Component APIs in Angular and Web ComponentsRachael L Moore
 
Creating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web ComponentsCreating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web ComponentsRachael L Moore
 
Android | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted NewardAndroid | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted NewardJAX London
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3David Bisset
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designerselliotjaystocks
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenarioArnauld Loyer
 
Javascript coding-and-design-patterns
Javascript coding-and-design-patternsJavascript coding-and-design-patterns
Javascript coding-and-design-patternsHernan Mammana
 
Abstracting functionality with centralised content
Abstracting functionality with centralised contentAbstracting functionality with centralised content
Abstracting functionality with centralised contentMichael Peacock
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingCartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingShane Church
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkNguyen Duc Phu
 
2012.sandiego.wordcamp
2012.sandiego.wordcamp2012.sandiego.wordcamp
2012.sandiego.wordcampBrandon Dove
 
Joomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignJoomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignAndy Wallace
 

Tendances (19)

jQuery UI and Plugins
jQuery UI and PluginsjQuery UI and Plugins
jQuery UI and Plugins
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
 
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
 
JD17NL Joomla! Overrides and alternate layouts
JD17NL Joomla! Overrides and alternate layoutsJD17NL Joomla! Overrides and alternate layouts
JD17NL Joomla! Overrides and alternate layouts
 
Ant User Guide
Ant User GuideAnt User Guide
Ant User Guide
 
Css, xhtml, javascript
Css, xhtml, javascriptCss, xhtml, javascript
Css, xhtml, javascript
 
Creating GUI Component APIs in Angular and Web Components
Creating GUI Component APIs in Angular and Web ComponentsCreating GUI Component APIs in Angular and Web Components
Creating GUI Component APIs in Angular and Web Components
 
Creating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web ComponentsCreating GUI container components in Angular and Web Components
Creating GUI container components in Angular and Web Components
 
WordPress and Ajax
WordPress and AjaxWordPress and Ajax
WordPress and Ajax
 
Android | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted NewardAndroid | Busy Java Developers Guide to Android: UI | Ted Neward
Android | Busy Java Developers Guide to Android: UI | Ted Neward
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenario
 
Javascript coding-and-design-patterns
Javascript coding-and-design-patternsJavascript coding-and-design-patterns
Javascript coding-and-design-patterns
 
Abstracting functionality with centralised content
Abstracting functionality with centralised contentAbstracting functionality with centralised content
Abstracting functionality with centralised content
 
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery TrainingCartegraph Live HTML, CSS, JavaScript and jQuery Training
Cartegraph Live HTML, CSS, JavaScript and jQuery Training
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
 
2012.sandiego.wordcamp
2012.sandiego.wordcamp2012.sandiego.wordcamp
2012.sandiego.wordcamp
 
Joomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template DesignJoomla! Day UK 2009 Template Design
Joomla! Day UK 2009 Template Design
 

Similaire à WordPress development paradigms, idiosyncrasies and other big words

How to learn to build your own PHP framework
How to learn to build your own PHP frameworkHow to learn to build your own PHP framework
How to learn to build your own PHP frameworkDinh Pham
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011David Carr
 
Getting Started With WordPress Development
Getting Started With WordPress DevelopmentGetting Started With WordPress Development
Getting Started With WordPress DevelopmentAndy Brudtkuhl
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010WordPress Development Confoo 2010
WordPress Development Confoo 2010Brendan Sera-Shriar
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme developmentTammy Hart
 
Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Paul Bearne
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Jon Peck
 
Wordpress Meetup 2 23 10
Wordpress Meetup 2 23 10Wordpress Meetup 2 23 10
Wordpress Meetup 2 23 10boonebgorges
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
Javascript
JavascriptJavascript
Javascripttimsplin
 
WordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPWordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPandrewnacin
 
WordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme HacksWordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme HacksJohn Pratt
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017Amanda Giles
 
Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Ian Wilson
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
عرض حول وردبريس
عرض حول وردبريسعرض حول وردبريس
عرض حول وردبريسMohammed SAHLI
 

Similaire à WordPress development paradigms, idiosyncrasies and other big words (20)

How to learn to build your own PHP framework
How to learn to build your own PHP frameworkHow to learn to build your own PHP framework
How to learn to build your own PHP framework
 
Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011Introduction to Plugin Programming, WordCamp Miami 2011
Introduction to Plugin Programming, WordCamp Miami 2011
 
Getting Started With WordPress Development
Getting Started With WordPress DevelopmentGetting Started With WordPress Development
Getting Started With WordPress Development
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010WordPress Development Confoo 2010
WordPress Development Confoo 2010
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
 
Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
 
Wordpress Meetup 2 23 10
Wordpress Meetup 2 23 10Wordpress Meetup 2 23 10
Wordpress Meetup 2 23 10
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sins
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
Javascript
JavascriptJavascript
Javascript
 
WordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPWordPress 3.0 at DC PHP
WordPress 3.0 at DC PHP
 
WordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme HacksWordCamp Detroit 2010 Wordpress Theme Hacks
WordCamp Detroit 2010 Wordpress Theme Hacks
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
عرض حول وردبريس
عرض حول وردبريسعرض حول وردبريس
عرض حول وردبريس
 

Dernier

QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Dernier (20)

QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

WordPress development paradigms, idiosyncrasies and other big words

  • 1. WordPress Development Paradigms, Idiosyncrasies and Other Big Words Tom Auger, Zeitguys inc. WordCamp Montreal, 2011
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. Paradigm: Themes and Templates
  • 24.
  • 25.
  • 26.
  • 27.  
  • 28.
  • 29.
  • 30.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. Action examples add_action('init', 'register_my_custom_post'); add_action('init', 'register_my_custom_taxonomy'); add_action('widgets_init', 'register_my_widget'); add_action('wp_enqueue_scripts', 'add_my_js_libs'); add_action('save_post', 'save_my_custom_meta');
  • 38.
  • 39.
  • 40. Filter Examples add_filter( 'excerpt_more', 'custom_more' ); add_filter( 'excerpt_length', 'my_length', 999 ); function my_length($length){ return 6; // six is average, right? }
  • 41.
  • 42.
  • 43.
  • 44. Idiom: The Loop and The Query
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 51.
  • 52.
  • 53. Pure SQL select * from wp_posts join wp_term_relationships on ID = object_id join wp_term_taxonomy on wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id and taxonomy = 'event-type' join wp_terms on wp_term_taxonomy.term_id = wp_terms.term_id and wp_terms.slug = 'speaking' join wp_postmeta on wp_postmeta.post_id = ID and meta_key = 'event-date' and meta_value = '2011-07-09' where post_type = 'event' and post_status = 'published'
  • 54. More Properer SQL select * from wp_posts as P join wp_term_relationships TR_EVENT on P .ID = TR_EVENT .object_id join wp_term_taxonomy TT_EVENT on TT_EVENT .term_taxonomy_id = TR_EVENT .term_taxonomy_id TT_EVENT .taxonomy = 'event-type' join wp_terms T_EVENT on TT_EVENT .term_id = T_EVENT .term_id and T_EVENT .slug = 'speaking' join wp_postmeta M_DATE on M_DATE .post_id = P.ID and M_DATE .meta_key = 'event-date' and M_DATE .meta_value = '2011-07-09' where P .post_type = 'event' and P .post_status = 'published'
  • 55. Don't Use Table Names! select * from {$wpdb->posts} P join {$wpdb->term_relationships} TR_EVENT on P.ID = TR_EVENT.object_id join {$wpdb->term_taxonomy} TT_EVENT on TT_EVENT.term_taxonomy_id = TR_EVENT.term_taxonomy_id TT_EVENT.taxonomy = 'event-type' join {$wpdb->terms} T_EVENT on TT_EVENT.term_id =T_EVENT.term_id and T_EVENT.slug = 'speaking' join {$wpdb->postmeta} M_DATE on M_DATE.post_id = P.ID and M_DATE.meta_key = 'event-date' and M_DATE.meta_value = '2011-07-09' where P.post_type = 'event' and P.post_status = 'published'
  • 56. More Saferer Query $wpdb->prepare (&quot;select * from {$wpdb->posts} P join {$wpdb->term_relationships} TR_EVENT on P.ID = TR_EVENT.object_id join {$wpdb->term_taxonomy} TT_EVENT on TT_EVENT.term_taxonomy_id = TR_EVENT.term_taxonomy_id TT_EVENT.taxonomy = 'event-type' join {$wpdb->terms} T_EVENT on TT_EVENT.term_id =T_EVENT.term_id and T_EVENT.slug = %s join {$wpdb->postmeta} M_DATE on M_DATE.post_id = P.ID and M_DATE.meta_key = 'event-date' and M_DATE.meta_value = %s where P.post_type = 'event' and P.post_status = 'published'&quot;, 'speaking', '2011-07-09' );
  • 57. But, Whenever We Can... get_posts(array( 'post_type' => 'event', 'tax_query' => array(array( 'taxonomy' => 'event-type', 'field' => 'slug' 'terms' => 'speaking' )), 'meta_query' => array(array( 'key' => 'event-date', 'value' => $todays_date )) ));
  • 58.
  • 60.
  • 61.
  • 62.
  • 63.
  • 65. Other Stuff for more time
  • 66. Paradigm: Post Types and Taxonomies
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.