Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge field files into theme / plugin #5

Open
BenBroide opened this issue Mar 9, 2018 · 3 comments
Open

Merge field files into theme / plugin #5

BenBroide opened this issue Mar 9, 2018 · 3 comments

Comments

@BenBroide
Copy link

I installed the template and followed the instructions, seems like the build process runs ok.
My question is, after the build process, which files I include back inside my theme/ plugin and how what is the best way way to include them?
This is probably a simple question but I didn't figure it out.
Thanks!

@AdsonCicilioti
Copy link

Same question

@webdevid
Copy link

any update about how to integrated this to plugin or theme??

@snnsnn
Copy link

snnsnn commented Oct 28, 2020

For those asking how to load, I am not sure if it is the correct way but carbon_fields_register_fields hook works:

function load_custom_carbon_fields() {
	// Include number field
	require_once PLUGIN_PATH . 'inc/number/class-number-field.php';
	require_once PLUGIN_PATH . 'inc/number/field.php';
}

add_action( 'carbon_fields_register_fields', 'load_custom_carbon_fields' );

I tweaked the file structure for the https://github.com/htmlburger/carbon-field-number for my own taste.

If you want to enque your own js file to registerFieldType, you can use admin_enqueue_scripts hook and don't forget to include dependencies that you use for your implementation:

'carbon-fields-core',
'react',
'react-dom',
'lodash',
'wp-data',
'wp-element',
'wp-hooks',
'wp-plugins',
'wp-edit-post',
'wp-i18n',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants