| 1 |
# Development environment |
| 2 |
|
| 3 |
This setup is only meant for development use - for production follow [](https://carbonfields.net/docs/carbon-fields-quickstart/?crb_version=2-1-0Quickstart](https://carbonfields.net/docs/carbon-fields-quickstart/?crb_version=2-1-0](https://carbonfields.net/docs/carbon-fields-quickstart/?crb_version=2-1-0) instead. |
| 4 |
|
| 5 |
1. Setup a blank WordPress installation |
| 6 |
1. Add a new `carbon-fields` directory inside your theme of choice and switch to it |
| 7 |
1. Fork this repository and clone your fork |
| 8 |
1. Run `git checkout development` |
| 9 |
1. Run `composer install` |
| 10 |
1. Run `npm install` or `yarn install` |
| 11 |
1. Run `npm run build` or `yarn run build` |
| 12 |
1. Add the following code to the top of your functions.php file: |
| 13 |
```php |
| 14 |
use Carbon_Fields\Container; |
| 15 |
use Carbon_Fields\Field; |
| 16 |
|
| 17 |
add_action( 'carbon_fields_register_fields', 'crb_attach_theme_options' ); |
| 18 |
function crb_attach_theme_options() { |
| 19 |
Container::make( 'theme_options', __( 'Theme Options', 'crb' ) ) |
| 20 |
->add_fields( array( |
| 21 |
Field::make( 'text', 'crb_text', 'Text Field' ), |
| 22 |
) ); |
| 23 |
} |
| 24 |
|
| 25 |
add_action( 'after_setup_theme', 'crb_load' ); |
| 26 |
function crb_load() { |
| 27 |
require_once( 'carbon-fields/vendor/autoload.php' ); |
| 28 |
\Carbon_Fields\Carbon_Fields::boot(); |
| 29 |
} |
| 30 |
``` |
| 31 |
|
| 32 |
# Preparation |
| 33 |
|
| 34 |
1. Make sure your local branches are up to date |
| 35 |
1. Always start your contribution branches from the `development` branch |
| 36 |
1. If you are making JavaScript contributions, run `npm run start` or `yarn start` to run the dev build task (tracks file changes) |
| 37 |
|
| 38 |
## Pull Request Process |
| 39 |
|
| 40 |
1. Target the `development` branch for pull requests |
| 41 |
1. Include a detailed description of your contribution |
| 42 |
1. Make sure you follow the current codestyle |
| 43 |
|