what we can learn from wordpress as a developer
DESCRIPTION
What we can learn from WordPress - become a better developer.TRANSCRIPT
What we can learn fromWordPress
Chandra Maharzantweet @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;! font-size: 17px;! margin: 0;}
/* =Image----------------------------- */
/* red color */
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 { background: #fff; color: #000; }
#selector-1,#selector-2,#selector-3 { background: #fff; color: #000;}
Sunday, March 25, 12
#comment-form { margin: 0;}
#commentForm {}#comment_form {}#abc-12 {}
Class names
Sunday, March 25, 12
#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;
}
Property : Value
Sunday, March 25, 12
•Firebug
• http://codex.wordpress.org/CSS_Coding_Standards
Useful Resources
Sunday, March 25, 12
PHP
Sunday, March 25, 12
/** * Tell WordPress to run twentyeleven_setup() when the * 'after_setup_theme' hook is run. */add_action( 'after_setup_theme', 'twentyeleven_setup' );
Comments
/** * 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
// 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 useelse :
....
....endif;
Comments
Sunday, March 25, 12
/** * 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 -->
Comments
Sunday, March 25, 12
$foo='somevalue';$foo2='somevalue2';$foo34var='somevalue3';$nicevar=somevalue4';
Variables
$my_array=array( 'foo'=>'somevalue', 'foo2'=>'somevalue2', 'foo3'=>'somevalue3', 'foo34'=>'somevalue3');
Sunday, March 25, 12
$foo = 'somevalue';$foo2 = 'somevalue2';$foo34var = 'somevalue3';$nicevar = somevalue4';
$my_array = array( 'foo' => 'somevalue', 'foo2' => 'somevalue2', 'foo3' => 'somevalue3', 'foo34' => 'somevalue3');
Better?
Sunday, March 25, 12
<?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; ?>
HTML
Sunday, March 25, 12
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' );
White Space
Sunday, March 25, 12
•x == 23
•foo && bar
•! foo
•function( $a, $b, $c )
•$concat . '-5'
•$term .= 'X'
In General
Sunday, March 25, 12
• http://codex.wordpress.org/WordPress_Coding_Standards
Reference
Sunday, March 25, 12
Thank you
Sunday, March 25, 12