Open mark-alexandre opened 3 months ago
It looks like you are using Composer to install the plugin, but forgot to require the Composer autoload.php file.
Look here:
use Carbon_Fields\Container;
use Carbon_Fields\Field;
add_action( 'carbon_fields_register_fields', 'crb_attach_theme_options' );
function crb_attach_theme_options() {
error_log('carbon_fields_register_fields hook called');
Container::make( 'theme_options', __( 'Theme Options' ) )
->add_fields( array(
Field::make( 'text', 'crb_text', 'Text Field' ),
Field::make( 'text', 'crb_text2', 'Text Field 2' ),
) );
}
add_action( 'after_setup_theme', 'crb_load' );
function crb_load() {
require_once( 'vendor/autoload.php' ); // required to boot the plugin
\Carbon_Fields\Carbon_Fields::boot();
}
It looks like you are using Composer to install the plugin, but forgot to require the Composer autoload.php file.
Hi, Thanks but I'm requiring correctly the Composer autoload... but elsewhere. I use Vinkla/Wordplate, and the Composer autoload is just loaded in the wp-config.php file :
It looks like you are using Composer to install the plugin, but forgot to require the Composer autoload.php file.
Hi, Thanks but I'm requiring correctly the Composer autoload... but elsewhere. I use Vinkla/Wordplate, and the Composer autoload is just loaded in the wp-config.php file :
Oh then the composer version will not work. The only option you have is to use non composer version.
Download the latest zip file form https://carbonfields.net/zip/latest/ and extract it into public/plugins/ folder
Version
Expected Behavior
The plugin/framework has to work
Actual Behavior
The plugin is detected and activated, Carbon classes are correctly loaded, and the options page I have created appears... but without any fields.
Container definition
Comments
Just tried the framework, but if a simple code like this one which comes from the documentation doesn't work, it's because the plugin itself seems to have problems. The only error I have spotted with this plugin active is this very generic one : "[17-Aug-2024 15:58:52 UTC] PHP Warning: foreach() argument must be of type array|object, null given in /var/www/public/wordpress/wp-admin/includes/plugin.php on line 1853"
Is this a problem with the latest Wordpress version ? Is this plugin mainained or not ?
Regards.