Git Product home page Git Product logo

acf-sync's Introduction

ACF Sync

  1. Ensure the WordPress Importer and ACF plugins are installed and active
  2. Install this plugin as a mu-plugin
  3. Add a hook in a sub-plugin, mu-plugin, theme or wherever to use the acf_sync_xml_file_location filter to specify the location for your XML config file, it is expected that you will commit this file to remain in sync with your collaborators
  4. Use the export/import buttons (everyone loves buttons) in "WordPress Admin Area" > "Custom Fields" > "Sync" to keep in sync
  5. Profit

Before including any ACF Fields you've exported to PHP, do a check like:

	if ( ! class_exists( 'ACF_Dev_Mode' ) or ! ACF_Dev_Mode::active() ) {
		// Require the PHP exports from ACF here
	}

Whenever you need to change an ACF field:

  1. Enable dev mode by adding define( 'ACF_DEV_MODE', true ); to your local-config.php.
  2. Make sure your local copy of the theme is up to date. Import fields using ACF sync.
  3. Then makes your amends, do a PHP export to acf_fields.php in the Keystone Structure plugin and commit.
  4. Then do an ACF sync and commit and push the changes to the .xml file in the theme.
  5. Disable dev mode.

Note that this plugin needs to be present on development and production, otherwise if you have fields defined in both DB (through the WP admin area) and in the PHP exports, you will see double sets of fields.

acf-sync's People

Contributors

scottsweb avatar simonwheatley avatar tomjn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.