How to persist custom posts, custom fields and styles on a Github repository?

I need to send a code to a third person through Github with custom posts and custom fields for them just add the posts.

I have tried to find this approach online but I could not find the answer since all of them just talk about version control between local and production WP.

I am using MAMP, ACF and Custom Post Type UI to develop the site, linking the custom fields to custom post.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

ACF has two options for this:

  1. PHP / JSON exports
  2. acf-json

Method 1)

Go to ACF->tools->select field->export file / generate PHP.

If you choose generate PHP, you can copy the result into a .php file in your theme, which you then need to include. You cannot import PHP exports though ACF again: the fields will be available but you will not be able to edit them through the ACF UI.

If you choose JSON, you can import them again and edit them through ACF.

Method 2)

I prefer this method: create a folder called acf-json in your main theme folder. ACF will detect the folder and automatically save a copy of the fields as JSON files.

Whichever method you choose, make sure to add/commit any files created/changed to your repo.

Never used the Custom Post Type UI plugin, but I imagine it has a similar import/export capability.

Alternatively, you can also share an export of your DB, but there will be no version control for fields/etc.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x