-
Notifications
You must be signed in to change notification settings - Fork 144
Local JSON #891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
EnablingAll bullet points done and available in https://github.com/WebDevStudios/custom-post-type-ui/tree/891-local-json |
Saving in UIAll bullet points done and available in https://github.com/WebDevStudios/custom-post-type-ui/tree/891-local-json |
Multisite ID appending got handled as part of the Saving in UI section |
Loading and precedenceNow passing in existing cptui data to override filters, and returning those if not empty, else reading from local JSON. Also available in https://github.com/WebDevStudios/custom-post-type-ui/tree/891-local-json |
CONFLICTAs is, we're wanting to prefer the database version over local JSON version. However, we allow adding new via UI, even if local version exists, and that would create a new option, BUT ONLY WITH THAT ONE NEW ITEM. So we have potential to freak people out if they have many registered which is very common. Do we want to try and merge database versions of specific types, and override loaded local copy of same slug, with the database version? Or perhaps if we have a local version, and no database version, force importing? |
switch to saving individual json files per post type/taxonomy ? instead of filtering the get content type functions, leave those alone and create new function for just reading json file(s) and load/combine data, dependent on if still 1 file or all files? a case of if is local being used, pull in info with this function, else, currently used function? |
creating some local content types, and then deleting the db copy, and then adding new afterwards would wipe out the local json copy IF storing all of them. So we need to get around that somehow. |
Need to account for any helper functions that are meant to fetch slugs and data. |
With individual json files for each post type, we still need to also account for loading specific files for specific sites. Specifically in |
This has been handled in our branch |
We have moved from an all-or-nothing approach to an individual content type getting their own file, and we combine into our desired array during loading/registration. |
We have |
I think #891 (comment) is still our biggest hurdle before primary development of this feature is handled and we're ready for general testing and confirmation of behavior. |
OMG FINALLY :O thanks a lot have been looking at your docs and stuff for years for this feature <3 |
On single WordPress installs this works like a charm!! Can't wait for this release ^_^ |
It should have multisite support generally working, unless I broke something somehow. The site ID should be getting appended to the generated JSON file. That said, I need to resume working on this sometime soon, and also do a good amount of testing before final release. Thanks for doing some testing ahead of time @ivenomweed :) |
@tw2113 yes it's adding the site ID properly it's not broken at all. But if you wanted to supply a post type let's say something like "portfolio" (like how acf-json works in a way) for each individual site from the theme it will only show up on the main site, not the sub-sites as when you are developing locally the JSON file is saved as
so it doesn't show up on all the sites basically. I modified the code a little bit to make it work. First: Second:
to
here am counting 0 as a global post type. I don't know if this is a dumb idea or not. And I have been using CPTUI for almost 6 straight years you bet I wud be testing it :P |
@ivenomweed if I'm understanding you correctly, you are wanting the ability to have locally saved CPT data that gets read and added to all the sites? I know with CPTUI-Extended, our premium extension, we have network-wide content types that we'll need to be minding here, but I am thinking at least initially, we want to make sure the free plugin has top notch support and functionality. |
@tw2113 aaah I see got it thanks for the clarification awesome work btw <3 |
For what it's worth, I'd just like to add that I've been testing this out on a single site and its working really well. A database revert to an older (pre newly added CPTs) saw these added as expected from the json. Looking forward to this being released, but I'll be running this branch for a certain project until it does. |
@andyplak Awesome to hear that it's looking to be pretty solid already, though I know I've stalled on finalizing and finishing it up as well. |
Uh oh!
There was an error while loading. Please reload this page.
We will be borrowing a lot from the pros, I mean, Advanced Custom Fields. Do we dare outright copy https://plugins.trac.wordpress.org/browser/advanced-custom-fields/tags/5.12.3/includes/local-json.php and amend as needed?
Enabling
Saving in UI
Avoiding file deletion.
git reset
to restore after clearing out database version. How can we avoid this nuisance step?{""}
import method doesn't trigger saving/deleting hooks, but still removes database options.Loading and precedence
Sync settings
CPTUI UI data display like tools, get code, listings.
Multi-Site
Extra testing
Confirm this does not interfere with CPTUI-Extended. Bonus points if made to work with Network-wide content types, or made to be able to work with that.
The text was updated successfully, but these errors were encountered: