carbon-fields icon indicating copy to clipboard operation
carbon-fields copied to clipboard

Carbon Fields CSS/JS library root defined incorrectly

Open utopicchaotica opened this issue 4 years ago • 3 comments

Version

  • Carbon Fields: 3.2.2
  • WordPress: 5.6.1
  • PHP: 7.4.15

Expected Behavior

It should be calling Carbon Field libs using the theme folder as root.

Actual Behavior

It's using WP root as CF root.

Container definition

// Carbon Fields setup
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' ) )
		->add_fields( array(
			Field::make( 'text', 'crb_text', 'Text Field' ),
		) );
}

add_action( 'carbon_fields_register_fields', 'crb_attach_post_meta' );
function crb_attach_post_meta() {
    Container::make( 'post_meta', __( 'Post Options' ) )
        ->where( 'post_type', '=', 'post' )
        ->add_fields( array(
            Field::make( 'text', 'crb_venue', 'Venue' ),
        ) );
}
/*function crb_attach_post_meta() {
	Container::make( 'post_meta', __( 'Page Customization' ) )
		->where( 'post_type', '=', 'page' )
		->add_fields( array(
			Field::make( 'text', 'crb_bg_page', 'Page Background' ),
		) );
}*/

add_action( 'after_setup_theme', 'crb_load' );
function crb_load() {
	require_once( 'vendor/autoload.php' );
	\Carbon_Fields\Carbon_Fields::boot();
}

Steps to Reproduce the Problem

I followed the quickstart to install with composer.

Screenshot with Chrome console errors.

image

utopicchaotica avatar Feb 23 '21 22:02 utopicchaotica

Hmm, this appears to be an issue with your setup.

Can you provide the following details:

  • Are you using a virtual host to setup the project?
  • Do you have Carbon Fields plugin installed?
  • Are you using Carbon Fields as a part of a plugin or a theme? Is the theme custom made or public?

jorostoyanov avatar Feb 25 '21 10:02 jorostoyanov

Using XAMPP on Win10.

I don't have the plugin installed because I couldn't get it to work and had to clean my WP root of the CF install. CF is part of the theme, which is custom made.

I ran the installer in the theme's folder as per the quickstart instructions. I think that's all the info I have on my setup process.

utopicchaotica avatar Feb 25 '21 19:02 utopicchaotica

I had a similar issue today and it appeared to be caused by a symbolic link for the plugin I was developing. The fix was to put the complete folder in the plugin directory as opposed to symbolic link.

MCKLtech avatar Apr 21 '22 19:04 MCKLtech