49
it takes one to know one WordPress and PHP with Lorelle VanFossen

WordPress and PHP - It Takes One to Know One

Embed Size (px)

Citation preview

Page 1: WordPress and PHP - It Takes One to Know One

it takes one to know one

WordPress and PHPwith Lorelle VanFossen

Page 2: WordPress and PHP - It Takes One to Know One
Page 3: WordPress and PHP - It Takes One to Know One

WordPress Stats 25% of all sites on the web are published on WordPress

The latest version of WordPress has been downloaded almost 20 million times.

Median hourly wage of a WordPress project is $50.

Typical salary range for US web industry position with WordPress dev/design experience is $55-74K. Mobile experience, add $5-10K.

oDesk reports an average of 5,500 WordPress jobs posted a month.

WordPress runs The New York Times, Wall Street Journal sites, Ford, NY University Library, CNN, Harvard Law School, Ben & Jerry, People Magazine, NASA, Time Magazine, GE, MTV Newsroom, BBC Top Gear, National Geographic, TechCrunch, BoingBoing, AIGA Portland, The Economist, Comedy.com, Mozilla, Wired, Samsung, Le Monde Newspaper, Lexus, Nikon Pressroom, Official Star Wars Blog, Kobe Bryant, Carnival Cruise Line, Jay-Z…

Page 4: WordPress and PHP - It Takes One to Know One

WordPress and PHP

• The core of WordPress is built on PHP• WordPress Themes:•WordPress Template Tags: Make WordPress go•WordPress Template Files: Make WordPress pretty•WordPress Functions.php file: Code in Design

• WordPress Plugins• Push the boundaries of WordPress• Separate code from design

Page 5: WordPress and PHP - It Takes One to Know One

WordPress Site Recipe• Ingredients:• 6 cups HTML/XHTML/HTML5• 8 cups CSS/CSS3• 1/2 cup JavaScript• 12 cups PHP• 7 cups WordPress Template Tags• 1 tablespoon common sense

Mix all ingredients into WordPress Template Files. Add MySQL data and process through the WordPress Loop. Add code from the functions.php file. Mix well. Season with WordPress Plugins and GPL.

Page 6: WordPress and PHP - It Takes One to Know One

PHP

Template Tags

WordPress Theme = Template Files

+ functions.php

WordPress Plugins

Generated Pageview

Page 7: WordPress and PHP - It Takes One to Know One

Anatomy of a Template Tag

<?php bloginfo('name'); ?><?php bloginfo('description'); ?>

<?php bloginfo('url'); ?>

<p>Powered by WordPress version <?php bloginfo('version'); ?></p>

Powered by WordPress version 3.4

Page 8: WordPress and PHP - It Takes One to Know One

Anatomy of a Template TagClickable header

<div id="header"><a href="<?php bloginfo('url'); ?>"

title="<?php bloginfo('name'); ?> - <?php bloginfo('description'); ?>">

<?php bloginfo('name'); ?></a>

</div>

<a href="http://lorelle.wordpress.com/" title="Lorelle on WordPress – WordPress

Tips">Lorelle on WordPress</a>

Page 9: WordPress and PHP - It Takes One to Know One

Anatomy of a Template Tag

<?php the_title(); ?>

Parameters: <?php the_title('before', 'after', display); ?>

<h2><?php the_title('Post Title: ', ' &raquo;'); ?></h2>

Post Title: Anatomy of a Template Tag »

Page 10: WordPress and PHP - It Takes One to Know One

Anatomy of a Template Tag

Boolean Template Tags connect multiple paramters together

<?php wp_list_categories( $args ); ?> 

<ul><?php wp_list_categories('orderby=name&include=3,5,16'); ?></ul>

Page 11: WordPress and PHP - It Takes One to Know One

The WordPress Loop<?php get_header(); if (have_posts()) :

while (have_posts()) : the_post(); the_content();

endwhile; endif; get_sidebar(); get_footer(); ?>

Page 12: WordPress and PHP - It Takes One to Know One

The WordPress Loop<?php get_header(); if (have_posts()) :

while (have_posts()) : the_post(); the_content();

endwhile; endif; get_sidebar(); get_footer(); ?>

Page 13: WordPress and PHP - It Takes One to Know One

<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>

<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->

<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>

<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>

<!-- REALLY stop The Loop. --> <?php endif; ?>

Page 14: WordPress and PHP - It Takes One to Know One

<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>

<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->

<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>

<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>

<!-- REALLY stop The Loop. --> <?php endif; ?>

WordPress Function Tags

Page 15: WordPress and PHP - It Takes One to Know One

<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>

<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->

<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>

<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>

<!-- REALLY stop The Loop. --> <?php endif; ?>

Page 16: WordPress and PHP - It Takes One to Know One

<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>

<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>

<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->

<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>

<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>

<!-- REALLY stop The Loop. --> <?php endif; ?>

Page 17: WordPress and PHP - It Takes One to Know One

WordPress Template Files• Modular elements create a WordPress Theme• Code and data called with template tags,

functions, conditional tags, and post queries• Automatic and customizable hierarchy

header.php

index.phpsingle.phppage.php

category.php

archive.php

sidebar.php

footer.php

If pageview is single and in category 3, show sidebar 2.

If pageview is category, show sidebar 3

If pageview is front, show sidebar on left.

If category view requested, automatically switch to category template file.

Page 18: WordPress and PHP - It Takes One to Know One

Extend WordPress Themes

Child Themesfunctions.php template fileWordPress Plugins

Page 19: WordPress and PHP - It Takes One to Know One

WordPress Child Themes

• Protect original files• Allow protected customization• Use CSS !important

inheritance. • Child Theme code overrides Parent Theme code.

• Child Theme customization lost with Theme change.

Page 20: WordPress and PHP - It Takes One to Know One

WordPress Theme functions.php file

• Template file strictly for adding code customization.• Uses WordPress Hooks to extend:• Parent Theme elements• WordPress Administration Screens

• Attaches to specific Theme, not all Themes.• Theme functions.php lost when changing Themes.

<!– - Set excerpt length from default to 200 words - - > function custom_excerpt_length( $length ) {

return 200; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

Page 21: WordPress and PHP - It Takes One to Know One

WordPress Theme functions.php file

• Add options to Administration Panels (backend)• Theme options• Change user interface• Add functionality

Page 22: WordPress and PHP - It Takes One to Know One

Power of WordPress ThemesTwenty-Eleven WordPress ThemeBuilt-in Customizations

Page 23: WordPress and PHP - It Takes One to Know One

WordPress Plugins• Extend WordPress Theme design and functionality• Preserve function with Theme switches• Extend WordPress Administration Screens

Page 24: WordPress and PHP - It Takes One to Know One

WordPress.com Stats

BuddyPress

XML Sitemap Generator

NextGEN Gallery

My Blog’s Building Blocks

@lorelleonwp

Page 25: WordPress and PHP - It Takes One to Know One

US Department of Homeland Insecurity

Idiocy Level for WordPress

Talk Like a Pirate DaySeptember 19, 2012Text Filter Suite WordPress Plugin

CSS Naked DayWordPress PluginAnnually in April

Suicide Squirrel Threat Advisory System

Related Ways to Take Action

WRP-CardsWordPress Plugin

Page 26: WordPress and PHP - It Takes One to Know One

Next of Kin WordPress PluginThis Plugin is useful for those that want their blog to out-live them, and serve as an online memorial. Even without use of this Plugin, all are recommended to make sure someone can handle their website in case of emergency.

Tags: afterlife, death, will

Page 27: WordPress and PHP - It Takes One to Know One

The Events Calendar WordPress Plugin

Page 28: WordPress and PHP - It Takes One to Know One

Edit Flow WordPress Plugin

• Designed for newsroom editorial workflow.• Tracks content to visualize content and priorities.

Page 29: WordPress and PHP - It Takes One to Know One

Edit Flow WordPress Plugin

Page 30: WordPress and PHP - It Takes One to Know One

WP Invoice WordPress Plugin

Page 31: WordPress and PHP - It Takes One to Know One

Feed Pauser WordPress Plugin

Page 32: WordPress and PHP - It Takes One to Know One

WP Content Filter

sh*t

F**k P***G*D

D****T

Ba***rd

A*****e

F****ER

Je**sSon of a b****h

D**n

Page 33: WordPress and PHP - It Takes One to Know One

Customizable Post ListingsCustomizable Comment

Listings

Page 34: WordPress and PHP - It Takes One to Know One

Customizable Post Listings

Page 35: WordPress and PHP - It Takes One to Know One

phpMyAdmin WordPress Plugin

Page 36: WordPress and PHP - It Takes One to Know One

MyFTP WordPress Plugin

Page 37: WordPress and PHP - It Takes One to Know One

http://lorelle.wordpress.com/2007/02/06/a-love-letter-to-wordpress-plugin-authors/

Page 38: WordPress and PHP - It Takes One to Know One

How NOT to Describe a WordPress Plugin

A New Plugin For Your New WordPress Version

The latest WordPress version was launched. Yes, WordPress 3.0 was already available and ready to optimize for our blog. Indeed, WordPress is always the best blogging platform for me and I believe for many other blogger. However, as in title, I will introduce you with a great WordPress Plugin which I believe perfectly match with WordPress 3.0. It can be said as a new plugin for a new WordPress blog.

Page 39: WordPress and PHP - It Takes One to Know One

How to Describe a WordPress Plugin

Best Blogroll WordPress Plugin

Allows customization of the blogroll or sidebar links.

Page 40: WordPress and PHP - It Takes One to Know One

Embrace Code Standards

Page 41: WordPress and PHP - It Takes One to Know One

Releasing WordPress Plugins Into the Wild• Test in variety of environments and start early. • TEST TEST TEST TEST TEST.• Know your licenses (understand GPL thoroughly)• Be ready to update fixes immediately.• Make it brain-dead stupid to use.• Add version numbers EVERYWHERE including

database option arrays.• Ask users the version number.• URL Bugs: Embrace https, subdomains,

subwebs.

Page 42: WordPress and PHP - It Takes One to Know One

Plugins in the Wild• Prepare for feedback

• Your site clearly shows links to Plugins and expertise• WordPress Plugin Directory• WordPress Support Forums

• Promote and Monitor• WordPress Support Forums• Google Search• Twitter• Facebook• Stackoverflow• oDesk

• Never assume.• Listen, Listen, Listen, LISTEN DAMN IT!

Page 43: WordPress and PHP - It Takes One to Know One

The WordPress Codex is your friendhttp://codex.wordpress.org/

Page 44: WordPress and PHP - It Takes One to Know One

Nine APIs in WordPress

Page 45: WordPress and PHP - It Takes One to Know One

Things you need to know to code WP• Code, Web, and Accessibility Standards • PHP 5+• JavaScript, AJAX, jQuery• Apache/Unix basics• HTML/CSS• XML• API• Trac/Subversion• Mobile

Page 46: WordPress and PHP - It Takes One to Know One

WordPressers justwanna havefun!

Page 47: WordPress and PHP - It Takes One to Know One

CTEC 280 Introduction to WordPress

• Only full college credit WordPress course in the world.

• Overview of WordPress publishing and content management platform• Content development• Layout and design• WordPress Themes• WordPress Plugins• Underlying technologies• Interactivity• Social web integration

Tues & Thurs6-8:30 PM

July 3 – August 23ITEM # 1867

Page 48: WordPress and PHP - It Takes One to Know One
Page 49: WordPress and PHP - It Takes One to Know One

Lorelle [email protected]

@lorelle @lorelleonwp

WordPress