Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What we can learn from WordPress as a developer

824 views

Published on

What we can learn from WordPress - become a better developer.

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

What we can learn from WordPress as a developer

  1. 1. What we can learn from WordPress Chandra Maharzan tweet @maharzanSunday, March 25, 12
  2. 2. Sunday, March 25, 12
  3. 3. Sunday, March 25, 12
  4. 4. What we ignore • Most simplest parts • Comments • White Space • Proper NamesSunday, March 25, 12
  5. 5. CSSSunday, March 25, 12
  6. 6. /* =Quote ----------------------------- */ .format-quote blockquote { ! color: #555; /* red color */ ! font-size: 17px; ! margin: 0; } /* =Image ----------------------------- */Sunday, March 25, 12
  7. 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. 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. 9. Class names #comment-form { margin: 0; } #commentForm {} #comment_form {} #abc-12 {}Sunday, March 25, 12
  10. 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. 11. Useful Resources •Firebug • http://codex.wordpress.org/ CSS_Coding_StandardsSunday, March 25, 12
  12. 12. PHPSunday, March 25, 12
  13. 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. 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. 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. 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. 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. 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. 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. 20. In General •x == 23 •foo && bar •! foo •function( $a, $b, $c ) •$concat . -5 •$term .= XSunday, March 25, 12
  21. 21. Reference • http://codex.wordpress.org/ WordPress_Coding_StandardsSunday, March 25, 12
  22. 22. Thank youSunday, March 25, 12

×