FAQ

General

Which is the minimum PHP version, supported by Carbon Fields?

We support PHP 5.3+.

Is Carbon Fields completely free?

Yes.

Can I use Carbon Fields for commercial purposes?

Sure, go ahead! It is completely open source.

Is Carbon Fields available as a Composer package?

Yes. The package name is htmlburger/carbon-fields. You can include it in your project by executing the following command:

composer require htmlburger/carbon-fields

Features

I don’t know much about PHP. Do you have an administration interface for creating containers and fields?

Nope. Our goal is to provide developers with an elegant and expressive code syntax to build containers and fields within WordPress.

What types of content does Carbon Fields support?

Carbon Fields supports literally all content types that you can think of. In addition to the full support for post typestaxonomy terms, users and comments, Carbon Fields allows you to create custom option pages and subpages, as well as custom widgets with your preferred fields. You can even create custom fields in your navigation menus.

What are the supported field types?

There is a whole bunch of them:

  • Text – simple text field;
  • Textarea – multi-line text field;
  • Rich Text – WYSIWYG content editor, similar to the default WordPress one;
  • Date– date picker field;
  • Time– time picker field;
  • DateTime– datetime picker field;
  • Color – a handy color picker;
  • Checkbox – single checkbox field;
  • Select – a dropdown field with custom options;
  • Radio – a set of radio buttons with custom options;
  • Radio Image – similar to Radio but the selection is made by clicking over custom images rather than radio boxes;
  • Set – a set of checkboxes with custom options;
  • Association – enables you to select one or more posts, taxonomies, users and/or comments;
  • File – a file upload field, saving either the attachment ID or the URL to the file;
  • Image – similar to File, but made specifically for images;
  • Map – Google Maps field with the option to manually select a pin, or find it by a certain address;
  • Separator – a delimiter that can be used between fields for presentational purposes;
  • Sidebar – allows selecting a sidebar, and creating custom sidebars on-the-fly;
  • Header Scripts – multi-line text field for header scripts, automatically printed in wp_head();
  • Footer Scripts – multi-line text field for footer scripts, automatically printed in wp_footer();
  • HTML – allows any HTML to be displayed. Can be used for presentation purposes;
  • Gravity Form – requires the Gravity Forms plugin, allows selecting a particular form;
  • Hidden – a hidden field for custom usage;
  • Complex – our fancy repeater field, allowing nestable repeatable sets of fields and groups to be created.

New fields can be created using our template project and a step-by-step guide which can be found here: https://github.com/htmlburger/carbon-field-template

Can I create repeatable sets of fields?

Yes. We call them Complex Fields – fields that contain other fields. You can even create complex fields with multiple sets of fields. Then, when creating a repeatable entry, you can select which set of fields to use.

Can I nest complex (repeatable) fields? If yes, how many levels deep?

Yes, you can nest the fields, at an unlimited depth. The only limit is your imagination. 🙂

Errors & Issues

I keep getting a “Parse error: syntax error, unexpected T_STRING” error. How can I fix it?

You’re probably using PHP 5.2 or older. The Carbon Fields library uses PHP namespaces, which are only supported in PHP 5.3+.

I get the following error: “Fatal error: Class ‘Container’ not found in…”

You’ve probably missed to import the namespaces of the essential classes before creating your containers and fields. To do that, in the file with your containers & fields definitions, add the following code to the top:

use Carbon_Fields\Container\Container;
use Carbon_Fields\Field\Field;