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

Grow Beyond Posts & Pages: Introduction to the Pods Framework

Jim True
August 03, 2017

Grow Beyond Posts & Pages: Introduction to the Pods Framework

Presented at Wordpress St. Petersburg by Jim True

We give an introduction to data driven, content rich websites using the Pods Framework. Learn how to incorporate custom post types and custom fields and connect them with powerful relationships using Pods.

Video: https://youtu.be/fxpH68u3sgw

Jim True

August 03, 2017
Tweet

More Decks by Jim True

Other Decks in Technology

Transcript

  1. Grow Beyond Posts & Pages
    Introduction to the Pods Framework

    A Content Development Framework for WordPress

    View Slide

  2. Jim True
    Support Lead & Community Manager

    Pods Framework
    pods.io | @podsframework
    jimtrue.com | @jimtrue

    View Slide

  3. Our Story Starts with YOU, a WordPress Developer

    View Slide

  4. Well, NOW you’re a WordPress Developer

    View Slide

  5. You’ve got a handful of Websites under your belt
    GYM SALON MUSEUM

    View Slide

  6. The Gym has gone Franchise crazy
    GYM

    View Slide

  7. The Salon expanded into Spa Services
    SALON

    View Slide

  8. The Museum added a Local Artists Program
    MUSEUM

    View Slide

  9. You could try throwing plugins or themes at the problem

    View Slide

  10. Or you could try managing with Pages…
     
     
    STAFF SCHEDULE CLASSES

    View Slide

  11. What if this was much easier?
     
     
    STAFF
    SCHEDULE
    CLASSES

    View Slide

  12. Pods to the RESCUE!

    View Slide

  13. Manage all your content in one place

    View Slide

  14. Create, Extend & add Fields to ANY Content
    Custom Post Types
    Custom Taxonomies
    Users
    Menus
    Posts Pages
    Comments
    WooCommerce
    ANY Plugin Post Type or Taxonomy

    View Slide

  15. Use Relationships to connect anything
     
     
    STAFF SCHEDULE
    CLASSES
    Trainer Teaches a Spin Class On Mondays

    View Slide

  16. Display Content in your Theme without code*
    *HTML & CSS, yes, but not PHP
    Works in Shortcodes, Widgets & Auto Templates

    View Slide

  17. The Pods Process
    Pods
    Plan Populate Prototype

    View Slide

  18. PLAN: Start with your Content Needs
     
     
    STAFF
    LOCATIONS
    Gym #60
    Honolulu, Hawaii

    555-1212

    [email protected]
    Trainers: Jim True
    Jim True
    [email protected]
    Honolulu, Hawaii

    555-1212

    Classes: Yoga, Spin

    View Slide

  19. Think about reusable Content as DATA
     
     
    STAFF
    LOCATIONS Gym #60
    Honolulu, Hawaii

    555-1212

    [email protected]
    Trainers: Jim True
    Jim True
    [email protected]
    Honolulu, Hawaii

    555-1212

    Classes: Yoga, Spin
    Locations
    City
    State
    Address
    Phone
    Email Address
    Trainers
    Staff
    Name
    Email Address
    Classes Taught
    Gym Location

    View Slide

  20. These are Custom Post Types & Custom Fields
    Locations
    City
    State
    Address
    Phone
    Email Address
    Trainers
    Staff
    Name
    Email Address
    Classes Taught
    Gym Location
    Post Types
    locations
    staff
    post_type meta_key
    locations city
    locations state
    locations address
    locations phone
    locations email
    staff full_name
    staff email
    staff classes_taught
    staff gym_location
    Custom Fields

    View Slide

  21. What are Custom Post Types?
    post_type WP Object
    post Posts
    page Pages
    attachment Media
    nav_menu_item Menus
    From the WordPress Codex:

    https://codex.wordpress.org/Post_Types

    View Slide

  22. The WordPress Way: register_post_type & register_meta
    function register_locations {
    register_post_type( 'locations',
    array(
    'labels' => array(
    'name' => __( 'Locations' ),
    'singular_name' => __( 'Location' )
    ),
    'public' => true,
    'has_archive' => true,
    'rewrite' => array('slug' => 'locations'),
    )
    );
    }

    add_action( ‘init’, ‘register_locations’);
    register_post_type
    https://codex.wordpress.org/Function_Reference/register_post_type/
    register_meta
    $args = array(
    'sanitize_callback' => 'sanitize_my_meta_key',
    'auth_callback' => 'authorize_my_meta_key',
    'type' => 'string',
    'description' => ‘Enter Address',
    'single' => true,
    'show_in_rest' => true,
    );
    register_meta( 'locations', ‘street_address’, $args );
    https://codex.wordpress.org/Function_Reference/register_meta/

    View Slide

  23. The Pods Way: Add New & Add Fields
    Add New Pod Add Field to the Pod

    View Slide

  24. DEMO: Creating Pods

    View Slide

  25. PLAN: Identify your Connections
     
     
    STAFF
    LOCATIONS

    View Slide

  26. Relationships prevent Double-Entry
     
     
    STAFF
    Full Name Email Location Classes
    Jim True [email protected] Hawaii Yoga, Spin
    Betty Rubble [email protected] Hawaii Spin, Rumba
    Barney Rubble [email protected] Alaska Rock Throwing
    Fred Flintstone [email protected] Alaska Rock Throwing, Rumba

    View Slide

  27. Connected Fields are the Relationships
    Locations
    City
    State
    Address
    Phone
    Email Address
    Trainers
    Staff
    Name
    Email Address
    Classes Taught
    Gym Location
    Classes
    Name
    Description
    Instructor
    Location can have multiple Trainers
    Trainers can teach multiple Classes

    View Slide

  28. Understanding Relationship Connections
    Locations
    Trainers
    Staff
    Classes Taught
    Gym Location
    Classes
    Instructor
    Location can have multiple Trainers
    Trainers can teach multiple Classes
    Multiple Single
    M : 1
    Multiple Single
    M : 1

    View Slide

  29. DEMO: Relationship Fields

    View Slide

  30. Treat your content like a Mail Merge
    instructor_name email_address
    Jim True [email protected]
    Betty Rubble [email protected]
    Barney Rubble [email protected]
    Fred Flintstone [email protected]
    Trainers
    Instructor:
    Email:
    Howdy
    Spreadsheet Mail Merge Template

    View Slide

  31. Pods Templates & Magic Tags
    post_title email_address
    Jim True [email protected]
    Betty Rubble [email protected]
    Barney Rubble [email protected]
    Fred Flintstone [email protected]
    Trainers
    Instructor: {@post_title}
    Email: {@email_address}
    Howdy {@post_title}
    post_type: trainers Pods Template

    View Slide

  32. Calling a Custom Template with Shortcode
    Custom Template
    Instructor: {@post_title}
    Email: {@email_address}
    Howdy {@post_title}
    Pods Template Shortcode
    [pods name=“trainers” limit=“-1”]
    Instructor: {@post_title}

    Email: {@email_address}
    Howdy {@post_title}
    [/pods]
    post_type: trainers

    View Slide

  33. Creating a Pods Template
    Create saved “Content Blocks” to re-use throughout your theme

    View Slide

  34. Calling a Pods Template with Shortcode
    Instructor: {@post_title}
    Email: {@email_address}
    Howdy {@post_title}
    Template: Email Header Shortcode
    [pods name=“trainers” limit=“-1”

    template=“Email Header”]
    post_type: trainers

    View Slide

  35. Special Magic Tag Handling
    Field Type Magic Tag
    Custom Field {@custom_field}
    Relationship Connection {@related_field.field_in_other_pod}
    WordPress “Content” {@post_content}
    WordPress “Featured Image” {@post_thumbnail}
    Permalink {@permalink}
    Related Record Permalink {@related_field.permalink}

    View Slide

  36. Template Tags in Pods Templates
    If this field display
    else
    display that
    Conditionals & Loops Template Tag
    [if field_name]

    … content

    [else]
    … content

    [/if]
    Loop through EACH
    related record
    [each related_field]
    … related content
    [/each]
    [if staff_member]


    [each staff_member]
    {@post_title}
    [/each]

    [else]
    No Staff Found!
    [/if]
    Example

    View Slide

  37. Pods Templates with Auto Templates
    Replaces “the_content”
    With your Pods Template
    Automatically in your theme


    Or you can output before or
    After “the_content”

    View Slide

  38. DEMO: Prototyping with Pods Templates

    View Slide

  39. What else can you do with Pods?
    Custom Settings Pages
    Great for common text used throughout the
    website, phone numbers, business hours, or
    address.

    View Slide

  40. What else can you do with Pods?
    Extending Users, Media or Other Plugins
    Allows you to add content where you couldn’t
    before or connect those plugins to your new
    content.

    View Slide

  41. What else can you do with Pods?
    Connect with PHP or REST API or Pods API
    We support WordPress Core Methods of
    communicating with the content created with
    Pods, the new REST API methods or our own
    internal API for flexible connection methods.

    View Slide

  42. Getting Help with Pods
    Installing: https://wordpress.org/plugins/pods/
    Support Forum: https://wordpress.org/support/plugins/pods/
    Documentation: https://pods.io/docs/
    Slack Chat: https://pods.io/chat/ #support channel

    View Slide

  43. We are a FREE Plugin with FREE Support
    Learn more @ https://friends.pods.io/

    View Slide

  44. Jim True
    Support Lead & Community Manager

    Pods Framework
    http://pods.io | @podsframework
    http://jimtrue.com | @jimtrue

    View Slide

  45. WordPress St Petersburg
    Meetups Monthly in St Pete @ Iron Yard

    1st & 2nd Thursdays every Month
    http://tampabaywp.org | @tampabaywp
    Slack Chat | Facebook Group | Meetup

    View Slide

  46. A VERY Heartfelt Thank you to
    Iron Yard St. Pete
    Last Meetup here in September
    Iron Yard St. Pete | @theironyard #tampabay

    View Slide