Beyond WP-CONTENT | #WCRaleigh

2,146 views
2,081 views

Published on

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

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,146
On SlideShare
0
From Embeds
0
Number of Embeds
49
Actions
Shares
0
Downloads
20
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide






































































  • Beyond WP-CONTENT | #WCRaleigh

    1. 1. BEYOND WP-CONTENT WordCamp Raleigh | 2010 @glennansley
    2. 2. PURPOSE
    3. 3. PURPOSE •WordPress file structure
    4. 4. PURPOSE •WordPress file structure •WordPress programing logic
    5. 5. PURPOSE •WordPress file structure •WordPress programing logic •Web and not-web resources
    6. 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. 7. WORDPRESS FILE STRUCTURE Root Directory This is the starting point for your file system •Notable Folders •wp-content •wp-includes •wp-admin
    8. 8. WORDPRESS FILE STRUCTURE WP-Content This is folder contains all the files unique to your site. •Notable Folders •plugins •themes •uploads •upgrades
    9. 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. 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. 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. 12. WordPress Programming Logic How does PHP traverse the WP file structure?
    13. 13. WordPress Programming Logic How does PHP traverse the WP file structure?
    14. 14. WordPress Programming Logic How does PHP traverse the WP file structure? • The first file is loaded, checked for errors, and processed
    15. 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. 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. 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. 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. 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. 20. WordPress Programming Logic How does PHP traverse the WP file structure?
    21. 21. WordPress Programming Logic How does PHP traverse the WP file structure? • wp-blog-header.php is a great reference for this illustration.
    22. 22. WordPress Programming Logic How does PHP traverse the WP file structure? • wp-blog-header.php is a great reference for this illustration.
    23. 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. 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. 25. WordPress Programming Logic Quick review so far
    26. 26. WordPress Programming Logic Quick review so far •WordPress is made up of several files organized in folders.
    27. 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. 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. 29. WordPress Programming Logic What happens as PHP traverses the WP file structure?
    30. 30. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Includes requested PHP scripts.
    31. 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. 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. 33. WordPress Programming Logic What happens as PHP traverses the WP file structure?
    34. 34. WordPress Programming Logic What happens as PHP traverses the WP file structure? •Invokes actions on the data in your server’s memory
    35. 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. 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. 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. 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. 39. WordPress Programming Logic Common errors based on a weak grasp of this behavior
    40. 40. WordPress Programming Logic Common errors based on a weak grasp of this behavior •Undefined data (objects, variables, constants, etc)
    41. 41. WordPress Programming Logic Common errors based on a weak grasp of this behavior •Undefined data (objects, variables, constants, etc) •Undefined functions
    42. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 83. BEYOND WP-CONTENT WordCamp Raleigh | 2010 @glennansley

    ×