SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
What we can learn from
                            WordPress

                            Chandra Maharzan
                              tweet @maharzan



Sunday, March 25, 12
Sunday, March 25, 12
Sunday, March 25, 12
What we ignore
                       • Most simplest parts
                        • Comments
                        • White Space
                        • Proper Names
Sunday, March 25, 12
CSS



Sunday, March 25, 12
/* =Quote
       ----------------------------- */
       .format-quote blockquote {
       ! color: #555; /* red color */
       ! font-size: 17px;
       ! margin: 0;
       }




       /* =Image
       ----------------------------- */

Sunday, March 25, 12
/* =Menu
       ----------------------------- */
       #access ul ul ul {
       ! left: 100%;
       ! top: 0;
       }
       /* Search Form */
       #branding #searchform {
       ! position: absolute;
       ! top: 3.8em;
       ! right: 7.6%;
       }

Sunday, March 25, 12
selector {
              property: value;
          }
          #selector-1,
          #selector-2,
          #selector-3 {
              background: #fff;
              color: #000;
          }
          #selector-1 { background: #fff; color: #000; }

Sunday, March 25, 12
Class names
                       #comment-form {
                           margin: 0;
                       }

                       #commentForm {}
                       #comment_form {}
                       #abc-12 {}

Sunday, March 25, 12
Property : Value
       #comment-form {
         -moz-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
         -webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
         box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
         font-size: 1em;
         position: absolute;
         top: 0;
         right: 0;
         bottom: 0;
         left: 0;
         width: 500px;
         height: auto;
       }


Sunday, March 25, 12
Useful Resources

                       •Firebug
                       • http://codex.wordpress.org/
                        CSS_Coding_Standards



Sunday, March 25, 12
PHP



Sunday, March 25, 12
Comments
       /**
        * Tell WordPress to run twentyeleven_setup() when the
        * 'after_setup_theme' hook is run.
        */
       add_action( 'after_setup_theme', 'twentyeleven_setup' );


       /**
        * Sets the post excerpt length to 40 words.
        *
        * To override this length in a child theme,
        * remove the filter and add your own
        * function tied to the excerpt_length filter hook.
        */
       function twentyeleven_excerpt_length( $length ) {



Sunday, March 25, 12
Comments
       // Turn on random header image rotation by default.
       add_theme_support( 'custom-header', array( 'random-
       default' => true ) );


       // Has the text been hidden?
       if ( 'blank' == get_header_textcolor() ) :
         ...
         ...
       // If the user has set a custom color for the text use
       else :
         ....
         ....
       endif;




Sunday, March 25, 12
Comments
       /**
        * The Template for displaying all single posts.
        *
        * @package WordPress
        * @subpackage Twenty_Eleven
        * @since Twenty Eleven 1.0
        */

       <div id="primary">
       ! <div id="content" role="main">
         .....
         .....
         </div><!-- #content -->
       </div><!-- #primary -->




Sunday, March 25, 12
Variables
       $foo='somevalue';
       $foo2='somevalue2';
       $foo34var='somevalue3';
       $nicevar=somevalue4';


       $my_array=array(
          'foo'=>'somevalue',
          'foo2'=>'somevalue2',
          'foo3'=>'somevalue3',
          'foo34'=>'somevalue3'
       );



Sunday, March 25, 12
Better?
                $foo        =   'somevalue';
                $foo2       =   'somevalue2';
                $foo34var   =   'somevalue3';
                $nicevar    =   somevalue4';


                $my_array = array(
                   'foo'   => 'somevalue',
                   'foo2' => 'somevalue2',
                   'foo3' => 'somevalue3',
                   'foo34' => 'somevalue3'
                );



Sunday, March 25, 12
HTML

         <?php if ( ! have_posts() ) : ?>
            <div id="post-1" class="post">
               <h1 class="entry-title">Not Found</h1>
               <div class="entry-content">
                  <p>Apologies, but no results were found.</p>
                  <?php get_search_form(); ?>
               </div>
             </div>
         <?php endif; ?>




Sunday, March 25, 12
White Space
      function te_custom_excerpt( $output ) {
      !   if ( has_excerpt() && ! is_attachment() ) {
      !     $output .= te_continue_reading_link();
      !   }
      !   return $output;
      }
      add_filter( 'get_the_excerpt', 'te_custom_excerpt' );




Sunday, March 25, 12
In General
                       •x == 23
                       •foo && bar
                       •! foo
                       •function( $a, $b,   $c )
                       •$concat . '-5'
                       •$term .= 'X'
Sunday, March 25, 12
Reference

                       • http://codex.wordpress.org/
                         WordPress_Coding_Standards




Sunday, March 25, 12
Thank you



Sunday, March 25, 12

Mais conteúdo relacionado

Mais procurados

Using shortcode in plugin development
Using shortcode in plugin developmentUsing shortcode in plugin development
Using shortcode in plugin development
gskhanal
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
Wynn Netherland
 
JS.Chi CSS Animations
JS.Chi CSS AnimationsJS.Chi CSS Animations
JS.Chi CSS Animations
Justin Meyer
 

Mais procurados (20)

Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
 
DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たち
 
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019Let's write secure drupal code! - Drupal Camp Pannonia 2019
Let's write secure drupal code! - Drupal Camp Pannonia 2019
 
Drupal 7 — Circle theme
Drupal 7 — Circle themeDrupal 7 — Circle theme
Drupal 7 — Circle theme
 
Let's write secure Drupal code! - Drupal Camp Poland 2019
Let's write secure Drupal code! - Drupal Camp Poland 2019Let's write secure Drupal code! - Drupal Camp Poland 2019
Let's write secure Drupal code! - Drupal Camp Poland 2019
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
HTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherHTML5 and CSS3 Refresher
HTML5 and CSS3 Refresher
 
CSS: A Slippery Slope to the Backend
CSS: A Slippery Slope to the BackendCSS: A Slippery Slope to the Backend
CSS: A Slippery Slope to the Backend
 
Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019Let's write secure Drupal code! DUG Belgium - 08/08/2019
Let's write secure Drupal code! DUG Belgium - 08/08/2019
 
Accelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gemAccelerated Native Mobile Development with the Ti gem
Accelerated Native Mobile Development with the Ti gem
 
Using shortcode in plugin development
Using shortcode in plugin developmentUsing shortcode in plugin development
Using shortcode in plugin development
 
JavaScript for Flex Devs
JavaScript for Flex DevsJavaScript for Flex Devs
JavaScript for Flex Devs
 
LESS
LESSLESS
LESS
 
Implementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 WorkshopImplementing Awesome: An HTML5/CSS3 Workshop
Implementing Awesome: An HTML5/CSS3 Workshop
 
Big Design Conference: CSS3
Big Design Conference: CSS3 Big Design Conference: CSS3
Big Design Conference: CSS3
 
JS.Chi CSS Animations
JS.Chi CSS AnimationsJS.Chi CSS Animations
JS.Chi CSS Animations
 
WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3WordPress Theme Design and Development Workshop - Day 3
WordPress Theme Design and Development Workshop - Day 3
 
LESS(CSS preprocessor)
LESS(CSS preprocessor)LESS(CSS preprocessor)
LESS(CSS preprocessor)
 
18. images in symfony 4
18. images in symfony 418. images in symfony 4
18. images in symfony 4
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
 

Destaque

Chandra Maharzan: Making a successful career out of WordPress
Chandra Maharzan: Making a successful career out of WordPressChandra Maharzan: Making a successful career out of WordPress
Chandra Maharzan: Making a successful career out of WordPress
wpnepal
 

Destaque (7)

Interesting Theme Shop Stats
Interesting Theme Shop StatsInteresting Theme Shop Stats
Interesting Theme Shop Stats
 
Maxxconnect Presentation
Maxxconnect PresentationMaxxconnect Presentation
Maxxconnect Presentation
 
Be HTML5-ready today
Be HTML5-ready todayBe HTML5-ready today
Be HTML5-ready today
 
Thucydides - /by Igor Rozdobudko
Thucydides - /by Igor RozdobudkoThucydides - /by Igor Rozdobudko
Thucydides - /by Igor Rozdobudko
 
Chandra Maharzan: The Future of Web Design Experience
Chandra Maharzan: The Future of Web Design ExperienceChandra Maharzan: The Future of Web Design Experience
Chandra Maharzan: The Future of Web Design Experience
 
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
 
Chandra Maharzan: Making a successful career out of WordPress
Chandra Maharzan: Making a successful career out of WordPressChandra Maharzan: Making a successful career out of WordPress
Chandra Maharzan: Making a successful career out of WordPress
 

Semelhante a What we can learn from WordPress as a developer

Metaprogramovanie #1
Metaprogramovanie #1Metaprogramovanie #1
Metaprogramovanie #1
Jano Suchal
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource
Kaz Watanabe
 

Semelhante a What we can learn from WordPress as a developer (20)

Metaprogramovanie #1
Metaprogramovanie #1Metaprogramovanie #1
Metaprogramovanie #1
 
Obscure Wordpress Functions That Are Actually Quite Useful
Obscure Wordpress Functions That Are Actually Quite UsefulObscure Wordpress Functions That Are Actually Quite Useful
Obscure Wordpress Functions That Are Actually Quite Useful
 
php2.pptx
php2.pptxphp2.pptx
php2.pptx
 
Why Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary ThingWhy Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary Thing
 
veracruz
veracruzveracruz
veracruz
 
veracruz
veracruzveracruz
veracruz
 
veracruz
veracruzveracruz
veracruz
 
veracruz
veracruzveracruz
veracruz
 
Ruby is Awesome
Ruby is AwesomeRuby is Awesome
Ruby is Awesome
 
Extending Moose
Extending MooseExtending Moose
Extending Moose
 
Ruby AST Tools
Ruby AST ToolsRuby AST Tools
Ruby AST Tools
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4
 
Fluent14
Fluent14Fluent14
Fluent14
 
Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)
 
メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02メタプログラミングPerl nagoya rubykaigi02
メタプログラミングPerl nagoya rubykaigi02
 
Perl object ?
Perl object ?Perl object ?
Perl object ?
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptx
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

What we can learn from WordPress as a developer

  • 1. What we can learn from WordPress Chandra Maharzan tweet @maharzan Sunday, March 25, 12
  • 4. What we ignore • Most simplest parts • Comments • White Space • Proper Names Sunday, March 25, 12
  • 6. /* =Quote ----------------------------- */ .format-quote blockquote { ! color: #555; /* red color */ ! font-size: 17px; ! margin: 0; } /* =Image ----------------------------- */ Sunday, March 25, 12
  • 7. /* =Menu ----------------------------- */ #access ul ul ul { ! left: 100%; ! top: 0; } /* Search Form */ #branding #searchform { ! position: absolute; ! top: 3.8em; ! right: 7.6%; } Sunday, March 25, 12
  • 8. selector { property: value; } #selector-1, #selector-2, #selector-3 { background: #fff; color: #000; } #selector-1 { background: #fff; color: #000; } Sunday, March 25, 12
  • 9. Class names #comment-form { margin: 0; } #commentForm {} #comment_form {} #abc-12 {} Sunday, March 25, 12
  • 10. Property : Value #comment-form { -moz-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2); box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2); font-size: 1em; position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 500px; height: auto; } Sunday, March 25, 12
  • 11. Useful Resources •Firebug • http://codex.wordpress.org/ CSS_Coding_Standards Sunday, March 25, 12
  • 13. Comments /** * Tell WordPress to run twentyeleven_setup() when the * 'after_setup_theme' hook is run. */ add_action( 'after_setup_theme', 'twentyeleven_setup' ); /** * Sets the post excerpt length to 40 words. * * To override this length in a child theme, * remove the filter and add your own * function tied to the excerpt_length filter hook. */ function twentyeleven_excerpt_length( $length ) { Sunday, March 25, 12
  • 14. Comments // Turn on random header image rotation by default. add_theme_support( 'custom-header', array( 'random- default' => true ) ); // Has the text been hidden? if ( 'blank' == get_header_textcolor() ) : ... ... // If the user has set a custom color for the text use else : .... .... endif; Sunday, March 25, 12
  • 15. Comments /** * The Template for displaying all single posts. * * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ <div id="primary"> ! <div id="content" role="main"> ..... ..... </div><!-- #content --> </div><!-- #primary --> Sunday, March 25, 12
  • 16. Variables $foo='somevalue'; $foo2='somevalue2'; $foo34var='somevalue3'; $nicevar=somevalue4'; $my_array=array( 'foo'=>'somevalue', 'foo2'=>'somevalue2', 'foo3'=>'somevalue3', 'foo34'=>'somevalue3' ); Sunday, March 25, 12
  • 17. Better? $foo = 'somevalue'; $foo2 = 'somevalue2'; $foo34var = 'somevalue3'; $nicevar = somevalue4'; $my_array = array( 'foo' => 'somevalue', 'foo2' => 'somevalue2', 'foo3' => 'somevalue3', 'foo34' => 'somevalue3' ); Sunday, March 25, 12
  • 18. HTML <?php if ( ! have_posts() ) : ?> <div id="post-1" class="post"> <h1 class="entry-title">Not Found</h1> <div class="entry-content"> <p>Apologies, but no results were found.</p> <?php get_search_form(); ?> </div> </div> <?php endif; ?> Sunday, March 25, 12
  • 19. White Space function te_custom_excerpt( $output ) { ! if ( has_excerpt() && ! is_attachment() ) { ! $output .= te_continue_reading_link(); ! } ! return $output; } add_filter( 'get_the_excerpt', 'te_custom_excerpt' ); Sunday, March 25, 12
  • 20. In General •x == 23 •foo && bar •! foo •function( $a, $b, $c ) •$concat . '-5' •$term .= 'X' Sunday, March 25, 12
  • 21. Reference • http://codex.wordpress.org/ WordPress_Coding_Standards Sunday, March 25, 12