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
  2. Create, Extend & add Fields to ANY Content Custom Post

    Types Custom Taxonomies Users Menus Posts Pages Comments WooCommerce ANY Plugin Post Type or Taxonomy
  3. Use Relationships to connect anything     STAFF

    SCHEDULE CLASSES Trainer Teaches a Spin Class On Mondays
  4. Display Content in your Theme without code* *HTML & CSS,

    yes, but not PHP Works in Shortcodes, Widgets & Auto Templates
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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/
  10. 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
  11. 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
  12. 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
  13. 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: <merge field: instructor_name> Email: <merge field: email_address> Howdy <merge field: instructor_name> Spreadsheet Mail Merge Template
  14. 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
  15. 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”] <p>Instructor: {@post_title}<br /> Email: {@email_address}</p> <p>Howdy {@post_title}</p> [/pods] post_type: trainers
  16. 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
  17. 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}
  18. 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]
 <ul id=“staff”> [each staff_member] <li>{@post_title}</li> [/each] </ul> [else] No Staff Found! [/if] Example
  19. 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”
  20. What else can you do with Pods? Custom Settings Pages

    Great for common text used throughout the website, phone numbers, business hours, or address.
  21. 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.
  22. 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.
  23. WordPress St Petersburg Meetups Monthly in St Pete @ Iron

    Yard
 1st & 2nd Thursdays every Month http://tampabaywp.org | @tampabaywp Slack Chat | Facebook Group | Meetup
  24. A VERY Heartfelt Thank you to Iron Yard St. Pete

    Last Meetup here in September Iron Yard St. Pete | @theironyard #tampabay