The WordPress University 2012

5,180 views

Published on

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

The WordPress University 2012

  1. 1. Stephanie Leary @sleary stephanieleary.com The WordPress University
  2. 2. New book coming Fall 2014! Content Strategy for WordPress demonstrates how to build structured content for higher ed sites. Sign up to be notified when it’s out: http://sleary.me/list
  3. 3. Steph’s Stuff • @sleary • stephanieleary.com • profiles.wordpress.org/sillybean • slideshare.net/stephanieleary
  4. 4. Why WordPress?
  5. 5. Common Situation • No staff • No budget • No server • Thousands of HTML files • ... and broken links • No search • No RSS feeds
  6. 6. 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
  7. 7. 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
  8. 8. 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
  9. 9. Compared to other CMSs • Core features work very well • Comments • RSS and Atom feeds • Permalinks • File uploads • Nonessential features relegated to plugins
  10. 10. WordPress Tour
  11. 11. 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
  12. 12. oEmbed • YouTube • DailyMotion • Vimeo • Flickr • Twitter • Scribd Check this out: http://www.youtube.com/watch?v=nTDNLUzjkpg Hooray!
  13. 13. Basic Roles • Administrator • Editor • edits pages, publishes others’ posts • Author • publishes their own posts • Contributor • submits their own posts to editor • Subscriber
  14. 14. Posts vs. Pages • Posts • date-based • non-hierarchical • categorized and tagged • Pages • hierarchical
  15. 15. Custom Fields, Taxonomies, and Post Types
  16. 16. Custom Fields • Adding more information to posts • Default input vs. custom meta boxes • Examples: content audit notes • Custom Meta Boxes class on GitHub
  17. 17. Taxonomies • Extra sets of categories and tags • tags, people, locations, departments • People • Locations • Departments
  18. 18. Taxonomies • Default taxonomies • Categories • Post Tags • Menus • Link categories • Custom examples • People • Locations • Departments • Colleges
  19. 19. Custom Post Types • Default post types • Posts • Pages • Attachments • Revisions • Menu Items • Custom examples • Courses • Faculty profiles • Specimen inventory • Reference catalogue
  20. 20. Post Types • Things that are not • blog posts, news • pages, information about your office • Anything that needs to be catalogued and displayed separately
  21. 21. Course Post Type • Custom fields: arbitrary entry • professor name • email • phone • course code • Taxonomies: selecting items from a list • college • department
  22. 22. Feeds
  23. 23. 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
  24. 24. 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
  25. 25. 5 Minute Installation! Unless your campus infrastructure sucks.
  26. 26. Basic Installation • Gather database information: name, username, password • Unzip files to server • View in browser • Fill in values • Pass Go, collect $200
  27. 27. 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_N etwork
  28. 28. Domain Mapping • snoopy.wordpress.com -> snoopycorp.com • snoopy.webserver-1.school.edu -> snoopy.school.edu • WordPress MU Domain Mapping
  29. 29. Network Sites U of Foo Liberal Arts Science Business Agriculture Law
  30. 30. Network Domains U of Foo Liberal Arts Science Business Agriculture Law foo.edu law.foo.edu arts.foo.edu business.foo.edu science.foo.edu ag.foo.edu
  31. 31. Child Themes Parent Theme Law Child Theme Arts Child Theme Business Child Theme Science Child Theme Ag Child Theme
  32. 32. Campus Network Colleges Clubs Administration Blogs Sports
  33. 33. Break
  34. 34. Themes
  35. 35. 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
  36. 36. get_header() Loop while (have_posts()): the_post(); the_title(); the_content(); comments_template(); endwhile; get_sidebar() get_footer()
  37. 37. 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.
  38. 38. 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 );
  39. 39. 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.
  40. 40. Which template? • Which theme file is used? • category-slug.php • category-id.php • category.php • archive.php • index.php • See Show Template plugin
  41. 41. Advanced Themes Page templates Conditional tags Multiple sidebars Widget areas Theme options Editor styles Tips: handling subcategories without tons of files conditional sidebars
  42. 42. 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: */
  43. 43. 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
  44. 44. get_header() Loop while (have_posts()): the_post(); the_title(); the_content(); comments_template(); endwhile; get_sidebar() get_footer() Child theme contains sidebar.php
  45. 45. get_header() echo do_shortcode('[gallery]'); get_sidebar() get_footer() Child theme contains page template or loop template part
  46. 46. 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
  47. 47. Building a Theme 1.Craft your HTML structure 2.Drop in WordPress template tags • the_title() • the_content() • etc. 3.Move common elements into include templates • Header • Footer • Sidebars • Search form
  48. 48. Building a Theme 4.Create widget areas 5.Handle comments and comment forms 6.Don't forget 404.php!
  49. 49. Conditional Tags Conditional 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
  50. 50. Conditional Tags is_home is_search is_day is_feed is_404 is_comments_ popup s_front_page is_time is_month is_attachment is_trackback is_active_ sid ebar is_archive is_date is_year is_singular is_preview is_admin comments_ o pen pings_open is_paged in_the_loop
  51. 51. Developing for WordPress
  52. 52. 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
  53. 53. Using Hooks
  54. 54. Excerpts for Pages function excerpts_for_pages() { add_post_type_support( 'page', 'excerpt' ); } add_action( 'init', 'excerpts_for_pages' );
  55. 55. [rules] function the_rules( $atts ) { return "These are the rules!"; } add_shortcode( 'rules', 'the_rules' );
  56. 56. 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’);
  57. 57. Admin Bar Link function 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 );
  58. 58. Settings API • Register settings • form action=”options.php” • update_option(‘foo’, ‘new value’); • get_option(‘foo’);
  59. 59. Troubleshooting • define('WP_DEBUG', true); • Debug Bar plugin • View hooks • See Nacin on debugging WordPress
  60. 60. 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’ )
  61. 61. 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?
  62. 62. Writing Secure Themes and Plugins • Use the Settings API • Check user capabilities • Check nonces and referrers • Validate user input • Escape output
  63. 63. Developer References • Mark Jaquith’s WordCamp Phoenix presentation • Professional WordPress Plugin Development
  64. 64. Theme & Plugin Q&A ???
  65. 65. Performance and Security
  66. 66. Backing Up • WP DB Backup (single sites, database only) • Backup Buddy (network, database and files, $$)
  67. 67. 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
  68. 68. Caching • WP Super Cache • W3 Total Cache • Hyper Cache • Batcache
  69. 69. 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
  70. 70. 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
  71. 71. More With WordPress
  72. 72. BuddyPress Social Network Layer
  73. 73. BuddyPress • Campus wide social network • Company-wide internal communication tool • Niche social network for interest topic
  74. 74. BuddyPress Plugins • Welcome Pack • Achievements • BuddyPress Share It • Group Suggest Widget • Simple Google Map Plugin
  75. 75. ScholarPress A Learning Management System for BuddyPress
  76. 76. Content Audit "Now we’re talking real CMS capability!"
  77. 77. The WordPress Community
  78. 78. 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.
  79. 79. 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.
  80. 80. Documentation • Codex • Forum • WP StackExchange • Trac • Developers’ blogs
  81. 81. Support • Active user forums on wordpress.org • Individual plugin & theme developers • Groups on LinkedIn • huge Twitter population • IRC channels
  82. 82. 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
  83. 83. Discussion IRC 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
  84. 84. News Events WordCamps • San Francisco • New York • local: central.wordcamp.org • WP Candy • Planet WordPress • wpMail.me • wpBeginner • wpTuts
  85. 85. Making the Case for WordPress
  86. 86. LAMP vs. IIS 7 • mod_rewrite • .htaccess • PHP-FPM • Postfix • URL Rewrite 1.1 • PHP running as FastCGI Nginx
  87. 87. 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:
  88. 88. Importing • Many importers other than built-in list • Writing your own MySQL-based import • HTML Import • Merging single installs into networks
  89. 89. Q&A
  90. 90. Demos? • Network administration • Plugins • BuddyPress • Content Audit • HTML Import

×