the wordpress university 2012

121
Stephanie Leary @sleary stephanieleary.com The WordPress University

Upload: stephanie-leary

Post on 17-May-2015

4.584 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: The WordPress University 2012

Stephanie Leary @sleary stephanieleary.com

The WordPress University

Page 2: The WordPress University 2012

New book coming Fall 2014!

Content Strategy for WordPressdemonstrates how to build structured

content for higher ed sites.

Sign up to be notified when it’s out:http://sleary.me/list

Page 3: The WordPress University 2012

Steph’s Stuff• @sleary

• stephanieleary.com

• profiles.wordpress.org/sillybean

• slideshare.net/stephanieleary

Page 4: The WordPress University 2012
Page 5: The WordPress University 2012

Why WordPress? 

Page 6: The WordPress University 2012

Common Situation• No staff

• No budget

• No server

• Thousands of HTML files

• ... and broken links

• No search

• No RSS feeds

Page 7: The WordPress University 2012

Advantages• Easy UI for managing posts and pages

• Scheduled publishing

• Clean URLs

• Feeds for everything

• One-click upgrades

• Widgets and menus

• Thousands of free plugins and themes

Page 8: The WordPress University 2012

Weaknesses• Lacks native reusable content & network-

wide internal linking system 

• Requires caching plugin, not included, to optimize speed

• Critical plugins can fail as WP advances

• Disjointed and incomplete advanced documentation

• Heavy use of pages can be problematic

• Lacks robust native workflow

Page 9: The WordPress University 2012

Compared to other CMSs

• Fast development cycles

• WP 3.0 to 3.1: 8 months

• 5-6 months more typical

• Drupal 6.0 to 7.0: 3 years

• Joomla 1.5 to 1.6: 3 years

• Cohesive, disciplined core developer group

• UI focused on ease of use

Page 10: The WordPress University 2012

Compared to other CMSs

• Core features work very well

• Comments

• RSS and Atom feeds

• Permalinks

• File uploads

• Nonessential features relegated to plugins

Page 11: The WordPress University 2012

WordPress Tour 

Page 12: The WordPress University 2012
Page 13: The WordPress University 2012
Page 14: The WordPress University 2012
Page 15: The WordPress University 2012
Page 16: The WordPress University 2012
Page 17: The WordPress University 2012
Page 18: The WordPress University 2012
Page 19: The WordPress University 2012
Page 20: The WordPress University 2012
Page 21: The WordPress University 2012
Page 22: The WordPress University 2012

Media Uploads• Limited to unpublicized list of MIMEs

• Easy to add or remove MIMEs

• Size/space limited by PHP, site settings

• Grouped into folders by date:

• wp-content/uploads/2012/10/file.jpg

• files/2012/10/file.jpg

Page 23: The WordPress University 2012

oEmbed

• YouTube

• DailyMotion

• Vimeo

• Flickr

• Twitter

• Scribd

Check this out:

http://www.youtube.com/watch?v=nTDNLUzjkpg

Hooray!

Page 24: The WordPress University 2012
Page 25: The WordPress University 2012
Page 26: The WordPress University 2012
Page 27: The WordPress University 2012

Basic Roles• Administrator

• Editor

• edits pages, publishes others’ posts

• Author

• publishes their own posts

• Contributor

• submits their own posts to editor

• Subscriber

Page 28: The WordPress University 2012

Posts vs. Pages• Posts

• date-based

• non-hierarchical

• categorized and tagged

• Pages

• hierarchical

Page 29: The WordPress University 2012

Custom Fields, Taxonomies, and

Post Types 

Page 30: The WordPress University 2012

Custom Fields• Adding more information to posts

• Default input vs. custom meta boxes

• Examples: content audit notes

• Custom Meta Boxes class on GitHub

Page 31: The WordPress University 2012
Page 32: The WordPress University 2012
Page 33: The WordPress University 2012

Taxonomies• Extra sets of categories and tags

• tags, people, locations, departments

• People

• Locations

• Departments

Page 34: The WordPress University 2012
Page 35: The WordPress University 2012
Page 36: The WordPress University 2012

Taxonomies• Default taxonomies

• Categories

• Post Tags

• Menus

• Link categories

• Custom examples

• People

• Locations

• Departments

• Colleges

Page 37: The WordPress University 2012

Custom Post Types

• Default post types

• Posts

• Pages

• Attachments

• Revisions

• Menu Items

• Custom examples

• Courses

• Faculty profiles

• Specimen inventory

• Reference catalogue

Page 38: The WordPress University 2012

Post Types• Things that are not

• blog posts, news

• pages, information about your office

• Anything that needs to be catalogued and displayed separately

Page 39: The WordPress University 2012

Course Post Type• Custom fields: arbitrary entry

• professor name

• email

• phone

• course code

• Taxonomies: selecting items from a list

• college

• department

Page 40: The WordPress University 2012
Page 41: The WordPress University 2012
Page 42: The WordPress University 2012

Feeds

Page 43: The WordPress University 2012

Feed Clean URL

Basic /feed/feed/atom

Comments /comments/feed

Category(slug: news)

/category/news/feed

Tag(slug: book)

/tag/book/feed

Multiple Tags(slugs: book, dvd)

/tag/book+dvd/feed

Page 44: The WordPress University 2012

Feed Clean URL

Author(nickname: Joe)

/author/joe/feed

Post Type(slug: course)

/feed/?post_type=course

Taxonomy(genre: mystery)

/genre/mystery/feed

Search Term(wordpress)

/feed/?s=wordpress

Page 45: The WordPress University 2012

5 Minute Installation!

Unless your campus infrastructure sucks.

Page 46: The WordPress University 2012

Basic Installation• Gather database information: name,

username, password

• Unzip files to server

• View in browser

• Fill in values

• Pass Go, collect $200

Page 47: The WordPress University 2012

Network Setup• Decide: subdirectories or subdomains?

• Wildcard DNS is not required if you are not letting people sign up for new sites on their own.

• Users already in the system can be added to the new site.

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

Page 48: The WordPress University 2012
Page 49: The WordPress University 2012

Domain Mapping• snoopy.wordpress.com ->

snoopycorp.com

• snoopy.webserver-1.school.edu -> snoopy.school.edu

• WordPress MU Domain Mapping

Page 50: The WordPress University 2012

Network Sites

U ofFoo

LiberalArts

Science

Business

Agriculture

Law

Page 51: The WordPress University 2012

Network Domains

U ofFoo

LiberalArts

Science

Business

Agriculture

Law

foo.edu

law.foo.edu

arts.foo.edubusiness.foo.edu

science.foo.edu

ag.foo.edu

Page 52: The WordPress University 2012

Child Themes

ParentTheme

Law Child Theme

Arts Child ThemeBusiness Child Theme

Science Child Theme

Ag Child Theme

Page 53: The WordPress University 2012

Campus Network

Colleges

Clubs

Administration

Blogs

Sports

Page 54: The WordPress University 2012

Break 

Page 55: The WordPress University 2012

Themes 

Page 56: The WordPress University 2012

Basic Theme Setup• styles.css and index.php

• More specific files for each archive type:

• Single post, page, or custom post type

• Category and tag archives; custom taxonomies

• Date-based archives (day, month, year)

• functions.php turns on feature support; works like mini-plugin

• header.php, footer.php, sidebar.php -- basic includes

• comments.php

Page 57: The WordPress University 2012

get_header()

Loopwhile (have_posts()): the_post(); the_title(); the_content(); comments_template();endwhile;

get_sidebar()

get_footer()

Page 58: The WordPress University 2012

The Loop• while (have_posts()) ... endwhile;

• Translation:

• if the invisible query found posts, then for each post, print the following:

• the_title();

• the_content();

• etc.

Page 59: The WordPress University 2012

Have Posts?

• What was requested?

• What was returned?

• How many posts were returned, and how many are displayed on this page?

global $wp_query;var_dump( $wp_query );

Page 60: The WordPress University 2012

How this comes together...

• You click a category link on a post.

• Based on your permalink structure, WordPress knows you are requesting a list of posts in that category. It queries the database.

• It finds 53 posts. Your Reading setting says 20 per page.

• WordPress assembles the first 20 posts' data, plus links to two more pages.

Page 61: The WordPress University 2012

Which template?• Which theme file is used?

• category-slug.php

• category-id.php

• category.php

• archive.php

• index.php

• See Show Template plugin

Page 62: The WordPress University 2012

Advanced ThemesPage templates

Conditional tags

Multiple sidebars

Widget areas

Theme options

Editor styles

Tips:

handling subcategories without tons of files

conditional sidebars

Page 63: The WordPress University 2012

Child Themes/* Theme Name: My Child Theme Description: A child of Parent Theme Version: 1.0 Author: Stephanie Leary  Template: parent */   @import url(../parent/style.css); /* Overrides: */

Page 64: The WordPress University 2012

Other Child Theme Files

• If template is present in child theme, it will be used instead of parent theme’s file

• BOTH functions.php files will be used

Page 65: The WordPress University 2012

get_header()

Loopwhile (have_posts()): the_post(); the_title(); the_content(); comments_template();endwhile;

get_sidebar()

get_footer()

Child theme contains sidebar.php

Page 66: The WordPress University 2012

get_header()

echo do_shortcode('[gallery]');get_sidebar(

)

get_footer()

Child theme contains page templateor loop template part

Page 67: The WordPress University 2012

Theme Frameworks

• A complete theme with many options• Page templates• Specific archives• Many widget areas• SEO features

• custom fields for keywords• title filters• Genesis Google snippet preview

• Can be overridden by child themes  

Page 68: The WordPress University 2012
Page 69: The WordPress University 2012
Page 70: The WordPress University 2012

Building a Theme1.Craft your HTML structure2.Drop in WordPress template tags

• the_title()• the_content()• etc.

3.Move common elements into include templates• Header• Footer• Sidebars• Search form

Page 71: The WordPress University 2012

Building a Theme4.Create widget areas5.Handle comments and comment

forms6.Don't forget 404.php!

Page 72: The WordPress University 2012

Conditional TagsConditional ID Slug Title Array Other

is_single X X X X

is_sticky X

is_page X X

is_page_template Filename

is_category X X X X

in_category X

is_tag X X X

has_tag X X X

is_tax X X X

is_author X Username Nickname X

has_excerpt X

Page 73: The WordPress University 2012

Conditional Tags

is_home is_search is_day is_feed is_404 is_comments_popup

is_front_page is_time is_month is_attachment is_trackback is_active_sidebar

is_archive is_date is_year is_singular is_preview is_admin

comments_open pings_open is_paged in_the_loop

Page 74: The WordPress University 2012

Developing for WordPress

Page 75: The WordPress University 2012

Hooks• Actions: places you can run your own

functions

• wp_head

• wp_footer

• Filters: things that can be altered with your own functions

• the_title

• the_content

Page 76: The WordPress University 2012

Using Hooks

Page 77: The WordPress University 2012

Excerpts for Pagesfunction excerpts_for_pages() {

add_post_type_support( 'page', 'excerpt' );

}

add_action( 'init', 'excerpts_for_pages' );

Page 78: The WordPress University 2012

[rules]function the_rules( $atts ) {

return "These are the rules!";

}

add_shortcode( 'rules', 'the_rules' );

Page 79: The WordPress University 2012

Capital P, dangit!function capital_P_dangit( $text ) {

return str_replace( 'Wordpress', 'WordPress', $text );

}

add_filter( ‘the_content’, ‘capital_P_dangit’);

add_filter( ‘the_title’, ‘capital_P_dangit’);

Page 80: The WordPress University 2012

Admin Bar Linkfunction linkme( $admin_bar ){

$admin_bar->add_menu( array('id' => 'my-item','title' => 'My Item','href' => '#','meta' => array(

'title' => __('My Item'),

),));

add_action( 'admin_bar_menu', ‘linkme', 100 );

Page 81: The WordPress University 2012

Settings API• Register settings

• form action=”options.php”

• update_option(‘foo’, ‘new value’);

• get_option(‘foo’);

Page 82: The WordPress University 2012

Troubleshooting• define('WP_DEBUG', true);

• Debug Bar plugin

• View hooks

• See Nacin on debugging WordPress

Page 83: The WordPress University 2012

Evaluating Themes and Plugins

• Search code for:

• base64()

• eval()

• include(../../wp-config.php)

• include(../../wp-load.php)

• Does it use updated libraries?

• wp_deregister_script( ‘jquery’ )

Page 84: The WordPress University 2012

Evaluating Themes and Plugins

• Are wp_head() and wp_footer() missing?

• Does it insert links you can’t remove?

• Does it pester you for commercial upgrades?

Page 85: The WordPress University 2012

Writing Secure Themes and

Plugins• Use the Settings API

• Check user capabilities

• Check nonces and referrers

• Validate user input

• Escape output

Page 86: The WordPress University 2012

Developer References

• Mark Jaquith’s WordCamp Phoenix presentation

• Professional WordPress Plugin Development

Page 87: The WordPress University 2012

Theme & Plugin Q&A

???

Page 88: The WordPress University 2012

Performance and Security

 

Page 89: The WordPress University 2012

Backing Up• WP DB Backup (single sites, database

only)

• Backup Buddy (network, database and files, $$)

Page 90: The WordPress University 2012

Upgrading• Do it! (But back up first.)

• If the FTP Settings screen appears, add direct file method to your config file. (See Codex page on wp-config.php.)

• Upgrading via Subversion

Page 91: The WordPress University 2012

Caching• WP Super Cache

• W3 Total Cache

• Hyper Cache

• Batcache

Page 92: The WordPress University 2012
Page 93: The WordPress University 2012
Page 94: The WordPress University 2012

Security Precautions

• Make sure WP files are group-writeable, not world

• directories: 644 or 664

• files: 755 or 775

• Set up permalinks and caching, then make .htaccess not writeable

• Change admin username

• Change database table prefix from wp_

• Create a database user other than root

Page 95: The WordPress University 2012

Security Precautions

• Move wp-config.php up one directory

• Limit administrators

• Use Members to create less privileged roles

• Prevent bogus login attempts with Login Lockdown

• Run WP Security Scan and Exploit Scanner

• Monitor filesystem with File Monitor Plus

Page 96: The WordPress University 2012

More With WordPress

 

Page 97: The WordPress University 2012

BuddyPressSocial Network Layer

Page 98: The WordPress University 2012

BuddyPress• Campus wide social network

• Company-wide internal communication tool

• Niche social network for interest topic

Page 99: The WordPress University 2012
Page 100: The WordPress University 2012
Page 101: The WordPress University 2012

BuddyPress Plugins

• Welcome Pack

• Achievements

• BuddyPress Share It

• Group Suggest Widget

• Simple Google Map Plugin

Page 102: The WordPress University 2012

ScholarPressA Learning Management System for

BuddyPress

Page 103: The WordPress University 2012

Content Audit"Now we’re talking real CMS capability!"

Page 104: The WordPress University 2012
Page 105: The WordPress University 2012
Page 106: The WordPress University 2012
Page 107: The WordPress University 2012
Page 108: The WordPress University 2012

The WordPress Community

 

Page 109: The WordPress University 2012

Development Philosophy

• 2.9, 3.0, 3.1, 3.5 are all major releases.

• 3.3.1 is a bugfix and security update.

• Old releases do not get security updates.

• Core developers set feature agenda for major releases based on Trac tickets, known problems, and user surveys.

Page 110: The WordPress University 2012

Development Philosophy

• Development schedule kept on make.wordpress.org/core.

• Meetings once a week in #wordpress-dev.

• If it can be covered by a plugin, let it. Core is for features most people need, or frameworks developers can build on.

• If you want it fixed sooner, patch it yourself.

Page 111: The WordPress University 2012

Documentation• Codex

• Forum

• WP StackExchange

• Trac

• Developers’ blogs

Page 112: The WordPress University 2012

Support• Active user forums on wordpress.org

• Individual plugin & theme developers

• Groups on LinkedIn

• huge Twitter population

• IRC channels

Page 113: The WordPress University 2012

Support• VIP Automattic (core creators) 

• Third party vendors such as MUSupport.net

• Core developers are also consultants

• WP-only hosts

• WP Engine

• Page.ly

• Sucuri.net security specialists

Page 114: The WordPress University 2012

DiscussionIRC channels

• #wordpress

• #wordpress-dev

• #buddypress

• #bbpress

Mailing Lists

• WP-Hackers

• WP-Edu

wp-edu.org

Development blogs

• make/core 

• make/ui 

• make/themes 

• make/accessibility

• make/wppolyglots

Page 115: The WordPress University 2012

News               EventsWordCamps

• San Francisco

• New York

• local: central.wordcamp.org

• WP Candy

• Planet WordPress

• wpMail.me

• wpBeginner

• wpTuts

Page 116: The WordPress University 2012

Making the Case for WordPress

 

Page 117: The WordPress University 2012

LAMP   vs.   IIS 7• mod_rewrite

• .htaccess

• PHP-FPM

• Postfix

• URL Rewrite 1.1

• PHP running as FastCGI

Nginx

Page 118: The WordPress University 2012

Open Source vs. Commercial

Open Source

Low or no initial budget outlay

Premium support options available

Variety of custom development options--------------------------------Shelley launched in 2009 with $2k

Commercial

High startup costs

Enterprise support contracts available

Often contracted to the CMS company for customization

-------------------------------Texas 2yr launching OmniUpdate this year: $52k+

Page 119: The WordPress University 2012

Importing• Many importers other than built-in list

• Writing your own MySQL-based import

• HTML Import

• Merging single installs into networks

Page 120: The WordPress University 2012

Q&A 

Page 121: The WordPress University 2012

Demos?• Network administration• Plugins

• BuddyPress• Content Audit• HTML Import