Hey there!
I am having problems creating a custom field for a widget. I am basically following what is found here https://siteorigin.com/docs/widgets-bundle/form-building/adding-custom-fields/.
I think I have followed every step, also including the custom class I made for the example via the code
function my_custom_fields_class_prefixes( $class_prefixes ) { $class_prefixes[] = 'My_Custom_Field_'; return $class_prefixes; } add_filter( 'siteorigin_widgets_field_class_prefixes', 'my_custom_fields_class_prefixes' ); function my_custom_fields_class_paths( $class_paths ) { $class_paths[] = get_template_directory() . '/includes/page-builder/fields/'; return $class_paths; } add_filter( 'siteorigin_widgets_field_class_paths', 'my_custom_fields_class_paths' );
Still, it returns this error when the widget is opened for editing in the page builder: “The class ‘SiteOrigin_Widget_Field_Better_Text’ could not be found. Please make sure you specified the correct field type and that the class exists.”
Any ideas?
Thanks!
Enrico
… BTW: I have called the custom field from a widget I created like this
As you can see, I have a filed named text with type => better-text
… really no one can help? :-(
… it seems not even Site Origin staff could help on this. Anyway I figured out later what the problem was, so I’ll post it here just in case someone else needs a solution to this.
When you add a new custom field, make sure to name the class file as “.class.php” or the thing will not recognize it, and you will be prompted with the error I got.
Thanks for posting this. That was exactly my problem.