sc0ttkclark/wordpress-fields-api

Readme updates, examples for common use-cases

sc0ttkclark opened this issue · 13 comments

Update specs with more details on usage of Fields API by third party apps/plugins, refresh readme so it's more clear and concise.

  • Main Readme refresh

Objects in order of progress, then by priority:

@tomharrigan and @nicholasio you are now owners of the use-cases / examples for your associated areas. Please flesh out 3-5 section + fields examples for each of your implementations and save them into /examples/{implementation}/{example}.md in the Repo

@wpsmith is now heading up the media prototype, you are also now in charge of the use-cases / examples for your associated area. Please flesh out 3-5 section + fields examples for your implementation and save them into /examples/media/{example}.md in the Repo.

Mte90 commented

Example are very interesting to evaluate the level of that feature plugin

Mte90 commented

To start on that i've studied the test files but i don't understand how to use the library.
I have to try with a phpdoc generation but without an example is very difficult to start.

Me too

Here's the current User Edit screen implementation, it's the best example I have right now for you as it's been my primary focus on testing the limits of the Fields API.

https://github.com/sc0ttkclark/wordpress-fields-api/blob/master/implementation/wp-admin/includes/class-wp-fields-api-user-profile.php

A typical example of a user section containing address information would be helpful, so for example:

section – address

  • address 1 (text)
  • address 2 (text)
  • town/city (text)
  • county/state (text)
  • Zip (text)
  • country (DDM)

Added address example to my new examples and docs pages that are about to go up :)

Added new doc page for Creating an Implementation (useful for those coming to help out with what we've got going already, based on User / Term screens we did):

https://github.com/sc0ttkclark/wordpress-fields-api/blob/master/docs/creating-an-implementation.md

Added some new examples too --

User Profile Screen:

Term Add / Edit Screen:

I would love to get some more use-cases so I can add more examples!

Added new doc page for Registering Fields and it's pretty comprehensive in walking you through what everything is and how to pull it all together.

https://github.com/sc0ttkclark/wordpress-fields-api/blob/master/docs/registering-fields.md

Also updated the main README.md to link to these new docs/examples:

https://github.com/sc0ttkclark/wordpress-fields-api/blob/master/README.md

Example fields for a CPT for "products" being sold (this is probably one of the more complex scenarios I can think of quickly):

  • Price (floating point numeric / text-field with validation or cast-to-float),
  • Taxable (boolean / checkbox),
  • Customizations (uses fields-api to display configuration selections for front-end output which would also be driven by fields-api)
    • expandable array of text-fields
    • each text-field associated with dropdown listing available field-types registered to the fields-api, for the admin to choose for front-end display
    • include expandable nested array for multiple-choices when the fields api shows on the front-end

Pages - I often need a subtitle and page header text separate from content.

What is the possibility for having a 'repeater' style field (a la ACF) on a page or custom post type? This would involve more than just the fields API (as I'm sure js would be required), but its a situation I often require. Use case: a page has a staff section, rather than making a custom post type, you just build a series of fields (name, position, email, etc) that can be added and deleted.

Could you add

  • Repeatable field implementation example?