Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordCamp Phoenix 2013 - Foundation 201 - File Structure, FTP, & MySQL

Brad Parbs
January 18, 2013

WordCamp Phoenix 2013 - Foundation 201 - File Structure, FTP, & MySQL

Brad Parbs

January 18, 2013
Tweet

More Decks by Brad Parbs

Other Decks in Technology

Transcript

  1. WordPress File
    Structure, FTP
    & MySQL
    Friday, January 18, 13

    View Slide

  2. brad parbs
    Core contributor for 3.5
    Co-founder of Snow Day
    Created theWPclass.com
    Have plugins on WP.org
    Open Source & Startup Fanatic
    WC:MKE Organizer
    Friday, January 18, 13

    View Slide

  3. @bradparbs
    [email protected]
    brrad.com
    Friday, January 18, 13

    View Slide

  4. file structure
    Friday, January 18, 13

    View Slide

  5. file structure
    Friday, January 18, 13

    View Slide

  6. file structure
    Friday, January 18, 13

    View Slide

  7. file structure
    the front end, loads up wp-blog-header.php
    Friday, January 18, 13

    View Slide

  8. file structure
    the front end, loads up wp-blog-header.php
    Friday, January 18, 13

    View Slide

  9. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    Friday, January 18, 13

    View Slide

  10. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    Friday, January 18, 13

    View Slide

  11. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    Friday, January 18, 13

    View Slide

  12. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    Friday, January 18, 13

    View Slide

  13. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    Friday, January 18, 13

    View Slide

  14. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    Friday, January 18, 13

    View Slide

  15. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    Friday, January 18, 13

    View Slide

  16. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    Friday, January 18, 13

    View Slide

  17. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Friday, January 18, 13

    View Slide

  18. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Friday, January 18, 13

    View Slide

  19. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Friday, January 18, 13

    View Slide

  20. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Friday, January 18, 13

    View Slide

  21. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Friday, January 18, 13

    View Slide

  22. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Friday, January 18, 13

    View Slide

  23. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Friday, January 18, 13

    View Slide

  24. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Friday, January 18, 13

    View Slide

  25. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Friday, January 18, 13

    View Slide

  26. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Friday, January 18, 13

    View Slide

  27. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Includes the WP library and classes
    Friday, January 18, 13

    View Slide

  28. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Includes the WP library and classes
    Friday, January 18, 13

    View Slide

  29. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Includes the WP library and classes
    WordPress multisites blog creation
    Friday, January 18, 13

    View Slide

  30. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Includes the WP library and classes
    WordPress multisites blog creation
    Friday, January 18, 13

    View Slide

  31. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Includes the WP library and classes
    WordPress multisites blog creation
    Handles trackbacks and pings sent to site
    Friday, January 18, 13

    View Slide

  32. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Includes the WP library and classes
    WordPress multisites blog creation
    Handles trackbacks and pings sent to site
    Friday, January 18, 13

    View Slide

  33. file structure
    the front end, loads up wp-blog-header.php
    used to activate users
    loads up wp-load.php, and loads the right template
    used to post comments, prevents duplicates
    our database credentials, some settings
    WP’s implementation of cron for some hosts
    Used to export Links, the default export doesn’t
    Loads all the other files needed for WP to run
    Handles user auth, login, registration, forgot pword
    Lets users post by email
    Includes the WP library and classes
    WordPress multisites blog creation
    Handles trackbacks and pings sent to site
    adds XML-RPC support
    Friday, January 18, 13

    View Slide

  34. file structure
    Friday, January 18, 13

    View Slide

  35. file structure
    Friday, January 18, 13

    View Slide

  36. file structure
    admin styles/functions
    Friday, January 18, 13

    View Slide

  37. file structure
    admin styles/functions
    Friday, January 18, 13

    View Slide

  38. file structure
    admin styles/functions
    the magic place
    Friday, January 18, 13

    View Slide

  39. file structure
    admin styles/functions
    the magic place
    Friday, January 18, 13

    View Slide

  40. file structure
    admin styles/functions
    the magic place
    functions/libraries
    Friday, January 18, 13

    View Slide

  41. file structure
    wp-content
    only place you should be placing files
    Friday, January 18, 13

    View Slide

  42. http://core.trac.wordpress.org/browser
    Friday, January 18, 13

    View Slide

  43. http://core.trac.wordpress.org/browser
    Friday, January 18, 13

    View Slide

  44. trunk = main development branch or working copy
    Friday, January 18, 13

    View Slide

  45. Friday, January 18, 13

    View Slide

  46. Friday, January 18, 13

    View Slide

  47. Friday, January 18, 13

    View Slide

  48. What’s in core code?
    /**
    * WordPress User Page
    *
    * Handles authentication, registering, resetting passwords, forgot password,
    * and other user handling.
    *
    * @package WordPress
    */
    /** Make sure that the WordPress bootstrap has run before continuing. */
    require( dirname(__FILE__) . '/wp-load.php' );
    // Redirect to https login if forced to use SSL
    if ( force_ssl_admin() && ! is_ssl() ) {
    ! if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
    ! ! wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    ! ! exit();
    ! } else {
    ! ! wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    ! ! exit();
    ! }
    }
    /**
    * Outputs the header for the login page.
    *
    * @uses do_action() Calls the 'login_head' for outputting HTML in the Log In
    *! ! header.
    * @uses apply_filters() Calls 'login_headerurl' for the top login link.
    * @uses apply_filters() Calls 'login_headertitle' for the top login title.
    * @uses apply_filters() Calls 'login_message' on the message to display in the
    *! ! header.
    * @uses $error The error global, which is checked for displaying errors.
    *
    * @param string $title Optional. WordPress Log In Page title to display in
    *! ! element.
    * @param string $message Optional. Message to display in header.
    * @param WP_Error $wp_error Optional. WordPress Error Object
    */
    function login_header($title = 'Log In', $message = '', $wp_error = '') {
    ! global $error, $interim_login, $current_site, $action;
    ! // Don't index any of these forms
    ! add_action( 'login_head', 'wp_no_robots' );
    ! if ( empty($wp_error) )
    ! ! $wp_error = new WP_Error();
    ! // Shake it!
    ! $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username',
    'incorrect_password' );
    ! $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
    Friday, January 18, 13

    View Slide

  49. What’s in core code?














    a> |
    <
    _e( 'Lost your password?' ); ?>





    <br/>function wp_attempt_focus(){<br/>setTimeout( function(){ try{<br/><?php if ( $user_login || $interim_login ) { ?><br/>d = document.getElementById('user_pass');<br/>d.value = '';<br/><?php } else { ?><br/>d = document.getElementById('user_login');<br/><?php if ( 'invalid_username' == $errors->get_error_code() ) { ?><br/>if( d.value != '' )<br/>d.value = '';<br/><?php<br/>}<br/>}?><br/>d.focus();<br/>d.select();<br/>} catch(e){}<br/>}, 200);<br/>}<br/><?php if ( !$error ) { ?><br/>wp_attempt_focus();<br/><?php } ?><br/>if(typeof wpOnload=='function')wpOnload();<br/>
    login_footer();
    break;
    } // end action switch
    Friday, January 18, 13

    View Slide

  50. What’s in core code?














    a> |
    <
    _e( 'Lost your password?' ); ?>





    <br/>function wp_attempt_focus(){<br/>setTimeout( function(){ try{<br/><?php if ( $user_login || $interim_login ) { ?><br/>d = document.getElementById('user_pass');<br/>d.value = '';<br/><?php } else { ?><br/>d = document.getElementById('user_login');<br/><?php if ( 'invalid_username' == $errors->get_error_code() ) { ?><br/>if( d.value != '' )<br/>d.value = '';<br/><?php<br/>}<br/>}?><br/>d.focus();<br/>d.select();<br/>} catch(e){}<br/>}, 200);<br/>}<br/><?php if ( !$error ) { ?><br/>wp_attempt_focus();<br/><?php } ?><br/>if(typeof wpOnload=='function')wpOnload();<br/>
    login_footer();
    break;
    } // end action switch
    Friday, January 18, 13

    View Slide

  51. wp-config.php - all your database credentials, some settings
    Important files (things you don’t to lose)
    .htaccess - controls rewriting site URLs, if you’re having URL
    issues or some 404s, delete this and ‘Regenerate Permalinks”
    Plugins Folder - all of your plugins will live here, active or not
    Themes Folder - all of your themes (hopefully just one) will be here
    Uploads Folder - all media uploaded is stored here
    Friday, January 18, 13

    View Slide

  52. file structure tips
    Friday, January 18, 13

    View Slide

  53. file structure tips
    1. Don’t modify core. Ever.
    Friday, January 18, 13

    View Slide

  54. file structure tips
    1. Don’t modify core. Ever.
    2. Don’t modify core. For real.
    Friday, January 18, 13

    View Slide

  55. file structure tips
    1. Don’t modify core. Ever.
    2. Don’t modify core. For real.
    3. Themes go in ‘themes’
    Friday, January 18, 13

    View Slide

  56. file structure tips
    1. Don’t modify core. Ever.
    2. Don’t modify core. For real.
    3. Themes go in ‘themes’
    4. Plugins go in ‘plugins’
    Friday, January 18, 13

    View Slide

  57. file structure tips
    1. Don’t modify core. Ever.
    2. Don’t modify core. For real.
    3. Themes go in ‘themes’
    4. Plugins go in ‘plugins’
    5. Uploads go in ‘uploads’
    Friday, January 18, 13

    View Slide

  58. file structure tips
    1. Don’t modify core. Ever.
    2. Don’t modify core. For real.
    3. Themes go in ‘themes’
    4. Plugins go in ‘plugins’
    5. Uploads go in ‘uploads’
    6. Don’t modify core.
    Friday, January 18, 13

    View Slide

  59. Let’s upload!
    Friday, January 18, 13

    View Slide

  60. Let’s upload!
    FTP clients let you graphically
    transfer files back and forth.
    Friday, January 18, 13

    View Slide

  61. http://filezilla-project.org/
    Friday, January 18, 13

    View Slide

  62. http://www.cpanel.net/media/tutorials/ftpacct.htm
    Friday, January 18, 13

    View Slide

  63. Creating/resetting your FTP
    password is easy with cPanel
    http://www.cpanel.net/media/tutorials/ftpacct.htm
    Friday, January 18, 13

    View Slide

  64. MySQL
    Friday, January 18, 13

    View Slide

  65. MySQL
    Your database is powered by MySQL!
    Friday, January 18, 13

    View Slide

  66. SQL code is scary
    CREATE TABLE `wp_creativeawesome_users` (
    `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    `user_login` varchar(60) NOT NULL DEFAULT '',
    `user_pass` varchar(64) NOT NULL DEFAULT '',
    `user_nicename` varchar(50) NOT NULL DEFAULT '',
    `user_email` varchar(100) NOT NULL DEFAULT '',
    `user_url` varchar(100) NOT NULL DEFAULT '',
    `user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    `user_activation_key` varchar(60) NOT NULL DEFAULT '',
    `user_status` int(11) NOT NULL DEFAULT '0',
    `display_name` varchar(250) NOT NULL DEFAULT '',
    PRIMARY KEY (`ID`),
    KEY `user_login_key` (`user_login`),
    KEY `user_nicename` (`user_nicename`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
    INSERT INTO `wp_creativeawesome_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url
    `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES
    (1, 'brad', '$P$B7K3fZtrgrVvnyfr.hVnIStIMpF9py0', 'brad', '[email protected]', '', '2012-09-08 01:42:14', '', 0,
    'brad');
    Friday, January 18, 13

    View Slide

  67. SQL code is scary
    Don’t mess around with it!
    CREATE TABLE `wp_creativeawesome_users` (
    `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    `user_login` varchar(60) NOT NULL DEFAULT '',
    `user_pass` varchar(64) NOT NULL DEFAULT '',
    `user_nicename` varchar(50) NOT NULL DEFAULT '',
    `user_email` varchar(100) NOT NULL DEFAULT '',
    `user_url` varchar(100) NOT NULL DEFAULT '',
    `user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
    `user_activation_key` varchar(60) NOT NULL DEFAULT '',
    `user_status` int(11) NOT NULL DEFAULT '0',
    `display_name` varchar(250) NOT NULL DEFAULT '',
    PRIMARY KEY (`ID`),
    KEY `user_login_key` (`user_login`),
    KEY `user_nicename` (`user_nicename`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
    INSERT INTO `wp_creativeawesome_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url
    `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES
    (1, 'brad', '$P$B7K3fZtrgrVvnyfr.hVnIStIMpF9py0', 'brad', '[email protected]', '', '2012-09-08 01:42:14', '', 0,
    'brad');
    Friday, January 18, 13

    View Slide

  68. The fun stuff: Theme Structure & Files
    Friday, January 18, 13

    View Slide

  69. http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  70. Not as scary as it looks...
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  71. Not as scary as it looks...
    For a static page:
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  72. Not as scary as it looks...
    For a static page:
    1. Checks for a custom template page
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  73. Not as scary as it looks...
    For a static page:
    1. Checks for a custom template page
    2. page-{slug}.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  74. Not as scary as it looks...
    For a static page:
    1. Checks for a custom template page
    2. page-{slug}.php
    3. page-{id}.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  75. Not as scary as it looks...
    For a static page:
    1. Checks for a custom template page
    2. page-{slug}.php
    3. page-{id}.php
    4. page.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  76. Not as scary as it looks...
    For a static page:
    1. Checks for a custom template page
    2. page-{slug}.php
    3. page-{id}.php
    4. page.php
    4. index.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  77. http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  78. Not as scary as it looks...
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  79. Not as scary as it looks...
    For category archives:
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  80. Not as scary as it looks...
    For category archives:
    1. category-{slug}.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  81. Not as scary as it looks...
    For category archives:
    1. category-{slug}.php
    2. category-{id}.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  82. Not as scary as it looks...
    For category archives:
    1. category-{slug}.php
    2. category-{id}.php
    3. category.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  83. Not as scary as it looks...
    For category archives:
    1. category-{slug}.php
    2. category-{id}.php
    3. category.php
    4. archive.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  84. Not as scary as it looks...
    For category archives:
    1. category-{slug}.php
    2. category-{id}.php
    3. category.php
    4. archive.php
    4. index.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  85. http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  86. Not as scary as it looks...
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  87. Not as scary as it looks...
    Need a custom 404?
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  88. Not as scary as it looks...
    Need a custom 404? 404.php
    http://codex.wordpress.org/Template_Hierarchy
    Friday, January 18, 13

    View Slide

  89. Not as scary as it looks...
    Need a custom 404? 404.php
    http://codex.wordpress.org/Template_Hierarchy
    Need a custom search result page?
    Friday, January 18, 13

    View Slide

  90. Not as scary as it looks...
    Need a custom 404? 404.php
    http://codex.wordpress.org/Template_Hierarchy
    Need a custom search result page? search.php
    Friday, January 18, 13

    View Slide

  91. Friday, January 18, 13

    View Slide

  92. @bradparbs
    [email protected]
    internetrockstar.org
    Friday, January 18, 13

    View Slide