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. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  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 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
  25. What’s in core code? <?php /** * 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 *! ! <title/> 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
  26. What’s in core code? <input type="hidden" name="interim-login" value="1" /> <?php!}

    else { ?> <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> <?php ! } ?> <?php if ( $customize_login ) : ?> <input type="hidden" name="customize-login" value="1" /> <?php endif; ?> <input type="hidden" name="testcookie" value="1" /> </p> </form> <?php if ( !$interim_login ) { ?> <p id="nav"> <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?> <?php elseif ( get_option('users_can_register') ) : ?> <a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ? a> | <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>">< _e( 'Lost your password?' ); ?></a> <?php else : ?> <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ? >"><?php _e( 'Lost your password?' ); ?></a> <?php endif; ?> </p> <?php } ?> <script type="text/javascript"> function wp_attempt_focus(){ setTimeout( function(){ try{ <?php if ( $user_login || $interim_login ) { ?> d = document.getElementById('user_pass'); d.value = ''; <?php } else { ?> d = document.getElementById('user_login'); <?php if ( 'invalid_username' == $errors->get_error_code() ) { ?> if( d.value != '' ) d.value = ''; <?php } }?> d.focus(); d.select(); } catch(e){} }, 200); } <?php if ( !$error ) { ?> wp_attempt_focus(); <?php } ?> if(typeof wpOnload=='function')wpOnload(); </script> <?php login_footer(); break; } // end action switch Friday, January 18, 13
  27. What’s in core code? <input type="hidden" name="interim-login" value="1" /> <?php!}

    else { ?> <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> <?php ! } ?> <?php if ( $customize_login ) : ?> <input type="hidden" name="customize-login" value="1" /> <?php endif; ?> <input type="hidden" name="testcookie" value="1" /> </p> </form> <?php if ( !$interim_login ) { ?> <p id="nav"> <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?> <?php elseif ( get_option('users_can_register') ) : ?> <a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ? a> | <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>">< _e( 'Lost your password?' ); ?></a> <?php else : ?> <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ? >"><?php _e( 'Lost your password?' ); ?></a> <?php endif; ?> </p> <?php } ?> <script type="text/javascript"> function wp_attempt_focus(){ setTimeout( function(){ try{ <?php if ( $user_login || $interim_login ) { ?> d = document.getElementById('user_pass'); d.value = ''; <?php } else { ?> d = document.getElementById('user_login'); <?php if ( 'invalid_username' == $errors->get_error_code() ) { ?> if( d.value != '' ) d.value = ''; <?php } }?> d.focus(); d.select(); } catch(e){} }, 200); } <?php if ( !$error ) { ?> wp_attempt_focus(); <?php } ?> if(typeof wpOnload=='function')wpOnload(); </script> <?php login_footer(); break; } // end action switch Friday, January 18, 13
  28. 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
  29. file structure tips 1. Don’t modify core. Ever. 2. Don’t

    modify core. For real. Friday, January 18, 13
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. Not as scary as it looks... For a static page:

    http://codex.wordpress.org/Template_Hierarchy Friday, January 18, 13
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. Not as scary as it looks... For category archives: 1.

    category-{slug}.php http://codex.wordpress.org/Template_Hierarchy Friday, January 18, 13
  43. 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
  44. 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
  45. 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
  46. 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
  47. Not as scary as it looks... Need a custom 404?

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

    404.php http://codex.wordpress.org/Template_Hierarchy Friday, January 18, 13
  49. 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
  50. 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