getting started with wordpress development
DESCRIPTION
A presentation from Iowa Code Camp 2010 by Kenny Younger (@kenny) and Andy Brudtkuhl (@abrudtkuhl)TRANSCRIPT
![Page 1: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/1.jpg)
Intro To WordPress Development
Kenny Younger (@kenny)&
Andy Brudtkuhl (@abrudtkuhl)
![Page 2: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/2.jpg)
What does WordPress look like to the users?
Let’s take a look!
![Page 3: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/3.jpg)
Database
![Page 4: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/4.jpg)
Database Schema
Source: SchemaBank.com
![Page 5: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/5.jpg)
File Structure
![Page 6: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/6.jpg)
• /– wp-admin/– wp-content/• plugins/
– Each plugin usually has its own directory
• themes/– Each theme has its own directory
• uploads/– Created on first upload (default location)
– wp-includes/– wp-config.php
![Page 7: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/7.jpg)
wp-config.php
define('WP_ALLOW_MULTISITE', true);
![Page 8: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/8.jpg)
Debugging made easy
define( 'SCRIPT_DEBUG', true );
Debugging flags added to wp-config.php:define( 'WP_DEBUG', true );
define( 'SAVEQUERIES', true ); $wpdb->queries
“All” hook:add_action( 'all', create_function( '', 'var_dump( current_filter() );' ) );
Core Control Plugin: http://wordpress.org/extend/plugins/core-control/
Dump Environment Plugin:http://wordpress.org/extend/plugins/dump_env/
Source: http://www.andrewnacin.com/2010/04/23/5-ways-to-debug-wordpress/
![Page 9: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/9.jpg)
WordPress Themes
What are themes? A way to skin WordPress
![Page 10: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/10.jpg)
What’s In A WordPress Theme?
• WordPress themes are a combination of PHP, CSS, and image files
• Requirements:• HTML• CSS• Some PHP
![Page 11: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/11.jpg)
Anatomy Of A WordPress Theme
![Page 12: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/12.jpg)
Theme Structure
• Index.php– includes header.php– Includes sidebar.php– Includes footer.php
![Page 13: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/13.jpg)
Standard Theme Architecture
• Homepage– index.php– home.php
• Single Post– single.php
• Page– page.php
• Category– category.php– archive.php
• Tags– tag.php
• Search Results– search.php
• 404– 404.php
![Page 14: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/14.jpg)
![Page 15: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/15.jpg)
The Stylesheet – style.css
The comment headers in the style.css provide meta info to WP are are REQUIRED
This stylesheet also controls the layout and design elements of your theme…
![Page 16: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/16.jpg)
Functions.php
Contains theme related functions and commonly is used to generate dynamic sidebars
![Page 17: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/17.jpg)
The Loop
If (havePosts)show post stuff
Elsenothing here!
End if
![Page 18: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/18.jpg)
Template Tags
• the_title()• the_permalink()• the_content()• the_excerpt()• And more!
![Page 19: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/19.jpg)
Theme Frameworks
![Page 20: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/20.jpg)
What Is A WordPress Plugin?
Plugins are used to add or enhance functionalities of your WordPress site
![Page 21: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/21.jpg)
The Plugin Directory
http://wordpress.org/extend/plugins/
![Page 22: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/22.jpg)
The Plugin API
• The API provides “Hooks” into WordPress• No more hacking the core• Made up of Actions and Filters• Actions = functions triggered by events
ie: Call function on user log in• Filters = functions that modify information
ie: Add facebook share button before post
![Page 23: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/23.jpg)
Plugin Data
Sometimes it’s necessary to store data…
For large amounts, create a new database table
For small amounts, use WordPress “Options” – a table with key/value pairs
![Page 24: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/24.jpg)
Admin Menus
• Custom option panels for users to update settings for your plugin
• Adds options in WordPress Admin Dashboard
![Page 25: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/25.jpg)
Users & Roles & Capabilities
WordPress is designed to handle multiple users – from admin and editors to subscribers
5 Pre-Defined Roles• Administrator• Editor• Author• Contributor• Subscriber
http://codex.wordpress.org/Roles_and_Capabilities
![Page 26: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/26.jpg)
Custom FieldsAllow attaching meta-data to posts.
http://www.smashingmagazine.com/2010/04/29/extend-wordpress-with-custom-fields/
![Page 27: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/27.jpg)
Custom Post Types
• Used for:– Real Estate Listing– Event Calendar– Movie Database– Issue Management / Ticket System– Etc.
![Page 28: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/28.jpg)
Custom Post Type Options• label• singular_label• description• public – query-able from public?• menu_position• menu_icon• hierarchical• query_var• capability_type – permissions• supports• rewrite• taxonomies• register_meta_box_cb• permalink_epmask
![Page 29: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/29.jpg)
Custom Post Types – Integration with the loop
<?php $loop = new WP_Query( array( 'post_type' => my_custom_post_type', 'posts_per_page' => 10 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' );
?><div class="entry-content">
<?php the_content(); ?></div>
<?php endwhile; ?>
![Page 30: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/30.jpg)
Taxonomies• What are taxonomies?
• register_taxonomy()– Shows up in menu system– Demo
register_taxonomy( 'actor', 'post', array(
'hierarchical' => false, 'label' => __('Actors', 'series'), 'query_var' => 'actor', 'rewrite' => array( 'slug' => 'actors' )
) );
![Page 31: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/31.jpg)
Core Development
• Versioning– 0.1 increments– Based on time, not features– Generally every 5-6 months– 0.0.1 – usually security fixes, other small bug fixes
• Always update!!
• Mailing lists: – http://codex.wordpress.org/Mailing_Lists
• Trac: – http://core.trac.wordpress.org
![Page 32: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/32.jpg)
Resources
• Planet - planet.wordpress.org• WordPress Codex – codex.wordpress.org• WordPress Forums – wordpress.org/support• All Things WordPress- wordpress.alltop.com • Core Development Blog – devel.wordpress.org
![Page 33: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/33.jpg)
August 7th, Downtown Des Moines Public Library
![Page 34: Getting Started With WordPress Development](https://reader035.vdocuments.net/reader035/viewer/2022062404/554bd93fb4c9058f6c8b53c5/html5/thumbnails/34.jpg)
Thanks!!!
Kenny Younger (@kenny)&
Andy Brudtkuhl (@abrudtkuhl)