Extending & Scaling | Dallas PHP

  • 3,240 views
Uploaded on

WordPress is an effective platform for powering large web sites with various types of content and structured data. In this case study, Randy Hoyt will share from his experience developing a network of …

WordPress is an effective platform for powering large web sites with various types of content and structured data. In this case study, Randy Hoyt will share from his experience developing a network of shopping center web sites on WordPress for a large property management company. He will explore the newer WordPress 3.x features, its child theme architecture, custom plugins, caching techniques, and cloud hosting infrastructure used to extend and scale WordPress for this project.

More in: Technology , Business
  • 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
3,240
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
0
Comments
0
Likes
10

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. About Me
    Web Developer – imaginuity.com
    Extending &Scaling
    WordPress
    By Randy Hoyt
    @randyhoyt#dallasphp
  • 2. @randyhoyt#dallasphp
    About Me
    Randy Hoyt randyhoyt.com
    @randyhoyt
    Presentation randyhoyt.com/lonestarwp
    #dallasphp
  • 3. About Me
    Web Developer – imaginuity.com
    Case Study
    @randyhoyt#dallasphp
  • 4. @randyhoyt#dallasphp
    Project Background
    Client: Jones Lang LaSalle (JLL)
    • Retail property management company
    Requirements:
    • Cost effective platform for 40-50 sites
    • 5. Consistent templates, allow customization
    • 6. Content updates by marketing managers
    • 7. Easily add or remove shopping centers
  • @randyhoyt#dallasphp
    Home Page
  • 8. About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Wireframe 2?
    A
    • a
    Store Directory
  • 9. About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Wireframe 2?
    A
    • a
    Store Detail Page
  • 10. @randyhoyt#dallasphp
    Content Requirements
    What types of content? Taxonomies?
    • Pages
    • 11. Stores Bath & Beauty, Jewelry,
    Music, Fitness, etc.
    • Events
    • 12. Job Listings Full-time, Part-time,
    Seasonal
    • Center Hours
  • About Me
    Web Developer – imaginuity.com
    Extending WordPress
    Functionality
    @randyhoyt#dallasphp
  • 13. About Me
    @randyhoyt#dallasphp
    Plugin Architecture
    Hooks:
    • Pre-defined places in WordPress where plugins and themes can inject their own code
    Two Types of Hooks:
    • Filters – For modifying various pieces of text
    • 14. Actions – For executing code triggered by an event
  • About Me
    @randyhoyt#dallasphp
    Filters
    • Modify pieces of text that WordPress generates
    • 15. Example:
    • 16. the_content()
    • 17. applied to the post content retrieved from the database, prior to printing on the screen
    • 18. Function:
    • 19. add_filter( $tag, $function, $priority, $args );
    • 20. Applies a function to a filter hook
    • 21. http://codex.wordpress.org/Function_Reference/add_filter
  • Screenshot TwentyTen
    @randyhoyt#dallasphp
    WP Tweet Button
    http://wordpress.org/extend/plugins/wp-tweet-button/
  • 22. Screenshot TwentyTen
    @randyhoyt#dallasphp
    198 add_filter('the_content', 'tw_update');
    578 function tw_update($content) {
    612 $button = tw_generate_button();
    621 return $button . $content;
    634 }
  • 23. About Me
    @randyhoyt#dallasphp
    Actions
    • Execute code when an event in WordPressoccurs
    • 24. Examples:
    • 25. init
    • 26. runs after the WordPress environment has been loaded
    • 27. admin_head
    • 28. runs after outputting the common HTML header for admin area
    • 29. Function:
    • 30. add_action( $tag, $function, $priority, $args );
    • 31. Applies a function to a filter hook
    • 32. http://codex.wordpress.org/Plugin_API/Action_Reference
  • @randyhoyt#dallasphp
    Custom Post Types
    WordPress can hold and display many different types of content. Internally, these are all stored in the same place, in the posts table. These are differentiated by a column called post_type.
    WordPress 3.0 gives you the capability to add your own custom post types.
    WordPress Codex: Post Types
    http://codex.wordpress.org/Post_Types
  • 33. @randyhoyt#dallasphp
    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    register_post_type( 'imag_store',
    array(
    'labels' => array(
    'name' => __('Stores'),
    'singular_name' => __('Store')
    ),
    'public' => true
    )
    );
    }
    WordPress Codex: Post Types > Custom Types
    http://codex.wordpress.org/Post_Types#Custom_Types
  • 34. @randyhoyt#dallasphp
    Custom Taxonomies
    A taxonomy is a way to group things together. In WordPress, a taxonomy is a grouping mechanism for posts or links or custom post types.
    WordPress Codex: Taxonomies
    http://codex.wordpress.org/Taxonomies
  • 35. @randyhoyt#dallasphp
    add_action( 'init', 'create_taxonomy' );
    function create_taxonomy() {
    register_taxonomy(
    'imag_store_category',
    'imag_store',
    array(
    'label' => __('Categories')
    )
    );
    }
    WordPress Codex: Taxonomies > Registering a Taxonomy
    http://codex.wordpress.org/Taxonomies#Registering_a_taxonomy
  • 36. About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Plugin: Custom Post Type UI
    http://wordpress.org/extend/plugins/custom-post-type-ui/
  • 37. About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Wireframe 2?
    A
    • a
    Store Detail Page
  • 38. @randyhoyt#dallasphp
    Custom Fields
  • 39. About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Store Page
    A
    Enable?
    • Custom Post Type UI
    • 41. Custom Field Templates
    • 42. Custom Meta Boxes
    • 43. Write Your Own
  • @randyhoyt#dallasphp
    Custom Fields
    Example: “Adding custom field to the post screen”
    Stack Overflow: http://r2h.me/9de6m
    Plugin: Custom Field Template
    http://wordpress.org/extend/plugins/custom-field-template/
    Library: Custom Meta Boxes
    http://www.billerickson.net/wordpress-metaboxes/
  • 44. @randyhoyt#dallasphp
    Custom Themes
    WordPress Themes are files that work together to create the design and functionality of a WordPress site.
    A theme consists of the following files:
    • stylesheet(s), JavaScript files, and images
    • 45. function file (functions.php)
    • 46. template files
    WordPress Codex: Theme Development
    http://codex.wordpress.org/Theme_Development
  • 47. @randyhoyt#dallasphp
    Child Themes
    A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify or add functionality.
    Making a child theme is very simple. Create a directory, put a properly formatted style.css file in it, and you have a child theme!
    WordPress Codex: Child Themes
    http://codex.wordpress.org/Child_Themes
  • 48. @randyhoyt#dallasphp
  • 49. @randyhoyt#dallasphp
    WordPress Codex: Template Hierarchy
    http://codex.wordpress.org/Template_Hierarchy
  • 50. About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Displaying Data
    Page templates
    single-imag_store.php
  • 52. About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Displaying Data
    Page templates
    archive-imag_store.php, taxonomy-imag_store_category.php
  • 54. @randyhoyt#dallasphp
    Page-Specific Custom Fields
  • 55. @randyhoyt#dallasphp
    Custom Settings
    A taxonomy is a way to group things together. In WordPress, a taxonomy is a grouping mechanism for posts or links or custom post types.”
    WordPress Settings API Tutorial
    http://ottopress.com/2009/wordpress-settings-api-tutorial/
  • 56. @randyhoyt#dallasphp
    Smashing Magazine: Mastering WordPress Shortcodes
    http://coding.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/
  • 57. @randyhoyt#dallasphp
    Menu
    Rearranging the WordPress Admin Menu
    • http://randyhoyt.com/wordpress/admin/
    WordPress Custom Post Type Icons
    • http://r2h.me/wpicons
  • About Me
    Web Developer – imaginuity.com
    Extending to a
    Network
    @randyhoyt#dallasphp
    @randyhoyt#dallasphp
  • 58. @randyhoyt#dallasphp
    WordPress Network
    As of WordPress 3.0, you have the ability to create a network of WordPress sites in a single installation.
    WordPress Codex: Create A Network
    http://codex.wordpress.org/Create_A_Network
  • 59. @randyhoyt#dallasphp
    Network Suggestions
    • Read the Codex Article Thoroughlyhttp://codex.wordpress.org/Create_A_Network
    • 60. Subfolder Configuration
    • 61. Plugin: WordPress MU Domain Mappinghttp://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/
  • @randyhoyt#dallasphp
    Network Suggestions
    • Put Custom Code In A Custom Plugin
    • 62. Network-Activate Plugins With Caution
    • 63. Create Additional Site for Shared Content
    Retailer Information, Social Updatesswitch_to_blog(7);restore_current_blog();
  • 64. About Me
    Web Developer – imaginuity.com
    Scaling:
    Architecture
    @randyhoyt#dallasphp
  • 65. @randyhoyt#dallasphp
    Server Architecture
  • 66. @randyhoyt#dallasphp
    Uploaded Images
    Amazon Simple Storage Service (S3)
    Amazon S3 is storage for the Internet. It’s a simple storage service that offers software developers highly-scalable, reliable, and low-latency data storage.
    Plugin: W3 Total Cache
    Improve site performance and user experience via caching: browser, page, object, database, minify and content delivery network support.
    Plugin: W3 Total Cache
    http://wordpress.org/extend/plugins/w3-total-cache/
  • 67. @randyhoyt#dallasphp
    Query Caching
    The query cache can have an astonishingly positive impact on the response time. MySQL stores the query’s result set. The results are extremely fast response times where clients are repetitively executing the same queries.
    A Practical Look at the MySQL Query Cache
    http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html
  • 68. @randyhoyt#dallasphp
    Page Caching
    WP Super Cache generates static HTML files from your dynamic WordPress blog. After an HTML file is generated your webserver will serve that file instead of processing the WordPress PHP scripts.
    Plugin: WP Super Cache
    http://wordpress.org/extend/plugins/wp-super-cache/
  • 69. About Me
    Web Developer – imaginuity.com
    Extending to
    Mobile
    @randyhoyt#dallasphp
  • 70. @randyhoyt#dallasphp
    Mobile Theme
    The mobile switcher identifies whether the visitor to the site is mobile or not, and switches between the primary WordPress theme and a mobile theme.
    • Browser Detection
    • 71. Domain Mapping
    Plugin: WordPress Mobile Pack
    http://wordpress.org/extend/plugins/wordpress-mobile-pack/
  • 72. @randyhoyt#dallasphp
    Mobile Theme
    Theme: Carrington Mobile
    http://wordpress.org/extend/themes/carrington-mobile
  • 73. @randyhoyt#dallasphp
    Think Vitamin: Getting Started With WordPress Custom Menus
    http://thinkvitamin.com/code/getting-started-with-wordpress-custom-menus/
  • 74. @randyhoyt#dallasphp
  • 75. About Me
    Web Developer – imaginuity.com
    Some Final
    Remarks
    @randyhoyt#dallasphp
  • 76. @randyhoyt#dallasphp
    Challenges
    Plugins in WordPress Network
    • Some plugins simply do not work (wp-content, uploads)
    • 77. Network activation does not activate site settings
    • 78. W3 Total Cache’s page caching did not work with subfolders
    • 79. Sometimes hard-coding configuration into a plugin is the best bet (SMTP)
    Custom Post Type Data Structure
    • Avoid too many JOINs; running two queries is often the best
    • 80. Queries can be difficult to write and perform slow
  • About Me
    Web Developer – imaginuity.com
    @randyhoyt#dallasphp
    Displaying Data
    Page templates
  • @randyhoyt#dallasphp
  • 82. @randyhoyt#dallasphp
    Plugins
  • About Me
    Web Developer – imaginuity.com
    Extending &Scaling
    WordPress
    By Randy Hoyt
    @randyhoyt#dallasphp