Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Funny that you mention this because it’s something that will be made a lot easier once I’m done with 0.9(Not soon, still).

    With the current stable version, the best you’ll have is finding the right options in the wp_options table and import those into the new site’s database. As long as you get the option keys the same, it should be pretty flawless.

    The way that this will work easier in 0.9 will be just some quick copy/pasting and submitting through a form. All of the values will be provided for you so literal just copy/paste.

    Something I’ll want to note at the time is that the user will need to upgrade to 0.9 before this will work well, but that’s mostly internal notes.

    Thread Starter John Huebner

    (@hube2)

    Thanks, I generally create the same post types an taxonomies on new sites, or at least I try to stay consistent when naming them. While it doesn’t take that long with the plugin it would be faster yet if I could just do an import.

    Even the copy past… I could create a file with things I can just past into the form. Will be looking forward to it.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hube2, here’s a preview of what this functionality will look like.

    http://cl.ly/image/3u3j3Z0l433Z

    Say you’re in the admin for the new location. The left side is where you’ll paste in content from the old site. What you’ll paste in is the content from the right side, from inside the old site. Same exact setup for post types.

    Thread Starter John Huebner

    (@hube2)

    You got me curious so I did a little digging into the database to look at your options and I have to say it got me a little excited 😛 and made the gears start to turn.

    Many people would create custom post types and then export and put it into the functions file of the theme or into a plugin. I don’t like doing that, things have a habit of changing more than we think they will. That’s why, even when I’m creating something I’ve created the same a dozen times I still like having the ability to edit the post type and taxonomies through this plugin. The same reason that I hate hard coding my fieldsets in ACF. Hard coding it and separating it from CPTUI means that I’d have to mess with the code to make any changes, and take a chance of screwing it up.

    But with this knowledge I could code a JSON string into a plugin to be used as part of activation, read the options stored by your plugin and insert the post types and taxonomies directly into the option for your plugin and have them available for editing just like I want when it changes.

    Insert them on activate and remove them on deactivate. A little work but easily automated.

    With this method I can both hard code them && be able to modify them if I need to. Then I just need to update the plugin with the new export.

    This is actually better than the export/import I was looking for because I can completely automate the process. I could even rewrite the JSON file when a plugin is deactivated to make sure the correct values are reinserted when it’s activated again.

    Very Cool! Appreciation for taking the time to show me this.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Sounds like you may be doing what our import/export will do, but taking it in your own direction, which is cool.

    Basically the CPTUI options save as a serialized array. What our future import/export page will do is fetch the option, which gets unserialized, and then displays in the “export” area as basic JSON data. I’ll be doing js to make selecting it select it all to make sure we don’t accidentally copy/paste partial stuff. On import, the JSON gets decoded back into an array and saved to the same option in the new site.

    If you wish to do similar things on your own, more power to you. This whole import/export part was a 3rd party contribution who will be getting credit in the readme and whatnot. We’re not ditching the “Get code” idea, but it is getting a code makeover. That way, people can still keep their post types/taxes and ditch our plugin if they so desire.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Export/Import’ is closed to new replies.