This setup is only meant for development use - for production follow Quickstart instead.
carbon-fields directory inside your theme of choice and switch to itgit checkout developmentcomposer installnpm install or yarn installnpm run build or yarn run buildAdd the following code to the top of your functions.php file:
use Carbon_Fields\Container;
use Carbon_Fields\Field;
add_action( 'carbon_fields_register_fields', 'crb_attach_theme_options' );
function crb_attach_theme_options() {
Container::make( 'theme_options', __( 'Theme Options', 'crb' ) )
->add_fields( array(
Field::make( 'text', 'crb_text', 'Text Field' ),
) );
}
add_action( 'after_setup_theme', 'crb_load' );
function crb_load() {
require_once( 'carbon-fields/vendor/autoload.php' );
\Carbon_Fields\Carbon_Fields::boot();
}
development branchnpm run start or yarn start to run the dev build task (tracks file changes)development branch for pull requests