htmlburger / carbon-fields

WordPress Custom Fields Library ✨
https://carbonfields.net/
Other
1.38k stars 245 forks source link

Carbon Fields CSS/JS library root defined incorrectly #970

Open utopicchaotica opened 3 years ago

utopicchaotica commented 3 years ago

Version

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

jorostoyanov commented 3 years ago

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

Can you provide the following details:

utopicchaotica commented 3 years ago

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.

MCKLtech commented 2 years ago

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.