Beyond WP-CONTENT | #WCRaleigh

  • 1,732 views
Uploaded on

A technical overview of the WordPress core files with the purpose of making you a more efficient developer

A technical overview of the WordPress core files with the purpose of making you a more efficient developer

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,732
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
13
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide






































































Transcript

  • 1. BEYOND WP-CONTENT WordCamp Raleigh | 2010 @glennansley
  • 2. PURPOSE
  • 3. PURPOSE •WordPress file structure
  • 4. PURPOSE •WordPress file structure •WordPress programing logic
  • 5. PURPOSE •WordPress file structure •WordPress programing logic •Web and not-web resources
  • 6. WORDPRESS FILE STRUCTURE Root Directory This is the starting point for your file system •Notable Files •index.php •wp-config.php •wp-load.php •xmlrpc.php
  • 7. WORDPRESS FILE STRUCTURE Root Directory This is the starting point for your file system •Notable Folders •wp-content •wp-includes •wp-admin
  • 8. WORDPRESS FILE STRUCTURE WP-Content This is folder contains all the files unique to your site. •Notable Folders •plugins •themes •uploads •upgrades
  • 9. WORDPRESS FILE STRUCTURE WP Admin This is the location for almost everything admin related. •Notable Files •admin.php •admin-header.php •options-*.php •edit-*.php
  • 10. WORDPRESS FILE STRUCTURE WP Admin This is the location for almost everything admin related. •Notable Folders •Notable Files in /includes •/includes •admin.php •meta-boxes.php •post.php •user.php
  • 11. WORDPRESS FILE STRUCTURE WP-INCLUDES This folder contains most of the heavy lifting for WP •Notable Files •class-http.php •functions.php •class-phpmailer.php •general-template.php •classes.php •pluggable.php •default-filters.php •query.php •formatting.php •user.php
  • 12. WordPress Programming Logic How does PHP traverse the WP file structure?
  • 13. WordPress Programming Logic How does PHP traverse the WP file structure?
  • 14. WordPress Programming Logic How does PHP traverse the WP file structure? • The first file is loaded, checked for errors, and processed
  • 15. WordPress Programming Logic How does PHP traverse the WP file structure? • The first file is loaded, checked for errors, and processed • It hits a PHP include, loads the requested file and processes down the script
  • 16. WordPress Programming Logic How does PHP traverse the WP file structure? • The first file is loaded, checked for errors, and processed • It hits a PHP include, loads the requested file and processes down the script • It in turn hits another include which processes down through two more includes
  • 17. WordPress Programming Logic How does PHP traverse the WP file structure? • The first file is loaded, checked for errors, and processed • It hits a PHP include, loads the requested file and processes down the script • It in turn hits another include which processes down through two more includes • At this point PHP is still processing data and there are no includes at the bottom of this file
  • 18. WordPress Programming Logic How does PHP traverse the WP file structure? • The first file is loaded, checked for errors, and processed • It hits a PHP include, loads the requested file and processes down the script • It in turn hits another include which processes down through two more includes • At this point PHP is still processing data and there are no includes at the bottom of this file • So PHP returns to the next line in the file we left and continues to process to the end of that file
  • 19. WordPress Programming Logic How does PHP traverse the WP file structure? • The first file is loaded, checked for errors, and processed • It hits a PHP include, loads the requested file and processes down the script • It in turn hits another include which processes down through two more includes • At this point PHP is still processing data and there are no includes at the bottom of this file • So PHP returns to the next line in the file we left and continues to process to the end of that file • At the end of file two, PHP returns to the next line in file one and continues to the end of the script.
  • 20. WordPress Programming Logic How does PHP traverse the WP file structure?
  • 21. WordPress Programming Logic How does PHP traverse the WP file structure? • wp-blog-header.php is a great reference for this illustration.
  • 22. WordPress Programming Logic How does PHP traverse the WP file structure? • wp-blog-header.php is a great reference for this illustration.
  • 23. WordPress Programming Logic How does PHP traverse the WP file structure? • wp-blog-header.php is a great reference for this illustration. Load the data
  • 24. WordPress Programming Logic How does PHP traverse the WP file structure? • wp-blog-header.php is a great reference for this illustration. Load the data Deliver the data
  • 25. WordPress Programming Logic Quick review so far
  • 26. WordPress Programming Logic Quick review so far •WordPress is made up of several files organized in folders.
  • 27. WordPress Programming Logic Quick review so far •WordPress is made up of several files organized in folders. •/wp-content is where developers make most modifications.
  • 28. WordPress Programming Logic Quick review so far •WordPress is made up of several files organized in folders. •/wp-content is where developers make most modifications. •PHP traverses this file structure in a logical manner, including only what is necessary for the current action.
  • 29. WordPress Programming Logic What happens as PHP traverses the WP file structure?
  • 30. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Includes requested PHP scripts.
  • 31. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Includes requested PHP scripts. •Loads functions into the server’s memory
  • 32. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Includes requested PHP scripts. •Loads functions into the server’s memory •Loads data into the server’s memory •REQUESTS •Database info •COOKIES and SESSIONS •CACHE •Constants, variables, class objects
  • 33. WordPress Programming Logic What happens as PHP traverses the WP file structure?
  • 34. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Invokes actions on the data in your server’s memory
  • 35. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Invokes actions on the data in your server’s memory •Spitting HTML out to the browser
  • 36. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Invokes actions on the data in your server’s memory •Spitting HTML out to the browser •Executing core PHP functions ( explode(), unset(), etc ).
  • 37. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Invokes actions on the data in your server’s memory •Spitting HTML out to the browser •Executing core PHP functions ( explode(), unset(), etc ). •Executing WordPress defined functions already in memory.
  • 38. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Invokes actions on the data in your server’s memory •Spitting HTML out to the browser •Executing core PHP functions ( explode(), unset(), etc ). •Executing WordPress defined functions already in memory. •Making remote requests to other scripts or web services
  • 39. WordPress Programming Logic Common errors based on a weak grasp of this behavior
  • 40. WordPress Programming Logic Common errors based on a weak grasp of this behavior •Undefined data (objects, variables, constants, etc)
  • 41. WordPress Programming Logic Common errors based on a weak grasp of this behavior •Undefined data (objects, variables, constants, etc) •Undefined functions
  • 42. WordPress Programming Logic Common errors based on a weak grasp of this behavior •Undefined data (objects, variables, constants, etc) •Undefined functions •Undefined class properties
  • 43. WordPress Programming Logic Common errors based on a weak grasp of this behavior •Undefined data (objects, variables, constants, etc) •Undefined functions •Undefined class properties •Missed hooks
  • 44. WordPress Programming Logic Common errors based on a weak grasp of this behavior •Undefined data (objects, variables, constants, etc) •Undefined functions •Undefined class properties •Missed hooks It’s all about the timing!
  • 45. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Hooks
  • 46. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Hooks •init (action)
  • 47. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Hooks •init (action) •admin_init (action)
  • 48. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Hooks •init (action) •admin_init (action) •template_redirect (action)
  • 49. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Hooks •init (action) •admin_init (action) •template_redirect (action) •plugins_loaded (action)
  • 50. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Functions
  • 51. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Functions •&get_posts
  • 52. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Functions •&get_posts •register_* ( importers, settings, widgets, posts, post types, taxonomies, menus )
  • 53. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Functions •&get_posts •register_* ( importers, settings, widgets, posts, post types, taxonomies, menus ) •helper functions ( get_the_title, get_permalink, etc )
  • 54. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Functions •&get_posts •register_* ( importers, settings, widgets, posts, post types, taxonomies, menus ) •helper functions ( get_the_title, get_permalink, etc ) •current_user_can
  • 55. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Functions •&get_posts •register_* ( importers, settings, widgets, posts, post types, taxonomies, menus ) •helper functions ( get_the_title, get_permalink, etc ) •current_user_can •wp_redirect
  • 56. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes
  • 57. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes •WP_Query
  • 58. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes •WP_Query •WP_User
  • 59. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes •WP_Query •WP_User •WP_Error
  • 60. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes •WP_Query •WP_User •WP_Error •Wp_Roles
  • 61. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes •WP_Query •WP_User •WP_Error •Wp_Roles •WP_Rewrite
  • 62. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes •WP_Query •WP_User •WP_Error •Wp_Roles •WP_Rewrite •WP_Http
  • 63. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Classes •WP_Query •WP_User •WP_Error •Wp_Roles •WP_Rewrite •WP_Http •PHPMailer
  • 64. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Files
  • 65. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Files •/wp-includes/pluggable.php
  • 66. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Files •/wp-includes/pluggable.php •/wp-includes/capabilities.php
  • 67. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Files •/wp-includes/pluggable.php •/wp-includes/capabilities.php •/wp-includes/default-filters.php
  • 68. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Files •/wp-includes/pluggable.php •/wp-includes/capabilities.php •/wp-includes/default-filters.php •/wp-includes/query.php
  • 69. My Tipping Point MVPs Some of the most helpful aspects of WP core that have helped me become a more efficient developer Files •/wp-includes/pluggable.php •/wp-includes/capabilities.php •/wp-includes/default-filters.php •/wp-includes/query.php •/wp-settings.php
  • 70. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web
  • 71. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web •http://wordpress.org/forums
  • 72. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web •http://wordpress.org/forums •http://codex.wordpress.org/
  • 73. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web •http://wordpress.org/forums •http://codex.wordpress.org/ •http://codex.wordpress.org/Mailing_Lists
  • 74. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web •http://wordpress.org/forums •http://codex.wordpress.org/ •http://codex.wordpress.org/Mailing_Lists •http://phpdoc.wordpress.org
  • 75. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web •http://wordpress.org/forums •http://codex.wordpress.org/ •http://codex.wordpress.org/Mailing_Lists •http://phpdoc.wordpress.org •http://twitter.com
  • 76. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web •http://wordpress.org/forums •http://codex.wordpress.org/ •http://codex.wordpress.org/Mailing_Lists •http://phpdoc.wordpress.org •http://twitter.com •http://wpdevel.wordpress.com/
  • 77. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Web •http://wordpress.org/forums •http://codex.wordpress.org/ •http://codex.wordpress.org/Mailing_Lists •http://phpdoc.wordpress.org •http://twitter.com •http://wpdevel.wordpress.com/ •#wordpress and #wordpress-dev
  • 78. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Not Web
  • 79. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Not Web •WordPress for Dummies - @LisaSabinWilson
  • 80. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Not Web •WordPress for Dummies - @LisaSabinWilson •The WordPress Bible - @technosailor
  • 81. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Not Web •WordPress for Dummies - @LisaSabinWilson •The WordPress Bible - @technosailor •Professional WordPress - @williamsba & @mirmillo
  • 82. My Tipping Point MVPs Some of the most helpful aspects of the WP community that have helped me become a more efficient developer Not Web •WordPress for Dummies - @LisaSabinWilson •The WordPress Bible - @technosailor •Professional WordPress - @williamsba & @mirmillo •Raleigh WP Meetup - http://meetup.com/Raleigh-WordPress-Meetup-Group/
  • 83. BEYOND WP-CONTENT WordCamp Raleigh | 2010 @glennansley