Skip to content

A github repository that enables creating a json file where any node can be retrieved as the top level json object

License

Notifications You must be signed in to change notification settings

fishdan-plugins/jsonmaker

Repository files navigation

fishdan Jsonmaker

WordPress License

fishdan Jsonmaker provides hierarchical link trees for WordPress pages: drop in the [jsonmaker] shortcode, manage nested URLs inline, and expose any node as live JSON.

Watch the fishdan Jsonmaker walkthrough on Loom.


✨ Features

  • Editable on the page – admins get inline “Add”, “Edit”, and “Delete” controls right beside each node.
  • Slugged JSON endpoints – visit /json/<node-slug>.json to retrieve that branch of the tree; perfect for toolbars or dashboards.
  • Flexible values – store either a URL or plain text; empty values create container nodes.
  • Role-based capability – grants a dedicated jsonmaker_manage capability to administrators (extendable to custom roles).
  • Single-option storage – the entire tree persists in jsonmaker_tree, avoiding extra tables or posts.

📦 Installation

  1. Copy the fishdan-jsonmaker folder into your WordPress wp-content/plugins directory, or upload the ZIP via Plugins → Add New → Upload Plugin.
  2. Activate fishdan Jsonmaker under Plugins → Installed Plugins.
  3. (Optional) Visit Settings → Permalinks and click Save to flush rewrite rules if /json/<slug>.json 404s.

🚀 Usage

  1. Insert the shortcode [jsonmaker] into any page or post.
  2. View the page while logged in as an administrator.
  3. Use the Add Node buttons to create child nodes. Titles must be unique; values are optional (leave blank to create a container).
  4. Use Edit to rename a node (its slug + JSON endpoint update automatically).
  5. Use Delete to remove a leaf node. Nodes with children must be emptied first.
  6. Access any node’s data at https://your-site.com/json/<slug>.json.

🔧 Developer Notes

  • Capability tweaks – hook into activation or map_meta_cap to grant jsonmaker_manage to additional roles.
  • Data shape – node arrays include title, slug, optional value, and optional children arrays.
  • Customization – override the inline styles by dequeuing them and enqueuing a custom stylesheet if desired.
  • Freemius SDK – access the telemetry/licensing SDK via the jsonmaker_fs() helper if you need to hook into its events.

🧪 Local Testing

php -l jsonmaker.php   # Syntax check

To exercise the JSON endpoint locally:

curl http://wpdev.local/json/fishdan.json

Replace fishdan with the slug shown in the add/edit forms.


📬 Support

Questions or ideas? Email dan@fishdan.com.


📝 License

MIT. See LICENSE for details.

About

A github repository that enables creating a json file where any node can be retrieved as the top level json object

Resources

License

Stars

Watchers

Forks

Packages

No packages published