I found the answer to my question. From the part, the problem was that I connected the vendor/autoload.php after accessing the __construct().
An example of solving this task below
use Carbon_Fields\Container;
use Carbon_Fields\Field;
class PluginOption
{
public function __construct()
{
require_once( 'vendor/autoload.php' );
\Carbon_Fields\Carbon_Fields::boot();
add_action( 'carbon_fields_register_fields', array( $this, 'crb_attach_theme_options') );
}
public function crb_attach_theme_options()
{
Container::make( 'theme_options', __( 'Plugin Option', 'crb' ) )
->add_fields( array(
Field::make( 'text', 'crb_text', 'Text Field' ),
) );
}
}
$wpTest = new PluginOption();
Related Posts:
- How can i force Display names to be the same as Usernames?
- Adding Custom Fields for Img in Posts
- Edit Imported advanced Custom Fields from wordpress Dashboard
- Add custom meta box on Post page
- how to display all posts Custom fields dynamically?
- add_meta_box Callback not being called
- Custom options page checkbox will not save, despite working with text
- Upload files programmatically to users
- How to create Repeater fields using Advanced Custom Fields?
- How can I filter the contents of a metafield before it’s displayed in the admin?
- Plugin not saving values when placed in a folder within /wp-content/plugins
- Security checking in meta_box save is reluctant?
- Last modified field for user profile?
- WordPress CMB2 – Run function on save
- FacetWP group listings by custom field [closed]
- how do i remove posts from a WP_Query so the pagination is right?
- Custom Field Template seriously messed up in WP 3.1.1
- UnWanted Custom field added in the wp page edit area
- Implement Autocomplete for a custom field on WordPress Plugin Frontend
- How to query the custom fields by language?
- auto populate list of questions if user select a category xyz
- is there a way to link one of the field in ACF field group, to a field in a media attachment page? [closed]
- How to create an input field, and base the output on spreadsheet data? [closed]
- How do I hide posts across all loops based on the value of a custom field?
- Execute js files doesn’t seem to work
- WordPress metaboxes – textfield suggestion automatically populated
- Char limit on custom blog-post form? [closed]
- Unable to select image using custom image field type
- How do I enforce users to fill a determined custom field using WyPiekacz?
- Adding class to last list item? Not WP generated
- How to Resize the Custom Post Images?
- Amazon.com intergration with WordPress?
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Order posts by meta key ( Using ACF )
- How to add fields in the WordPress editor?
- WordPress function to add text warning on every pages [closed]
- Price comparison table based on Custom Post Type?
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- How can I store data from custom fields to custom tables?
- Woocommerce – Change Variable Product Add to Cart to behave like external product using Custom Field (link) [closed]
- Custom Fields for Page Edits
- “After file loaded” action
- Plugin that lets visitors Like a post (not facebook) and stores likes in custom meta?
- Parent Child Custom Fields with Advanced Custom Fields
- grab or load text on demand
- Dictionary-style definition list plugin
- Advanced Custom Fields Plugin – Images not displaying
- Adding custom Field To The Posts Listing
- How to create repeater field manually, without plugin (ACF Pro)?
- WordPress Phone Field Check (use numbers, spaces and pluses)
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Table of contents (TOC) plugin is not showing header tag
- Best approach to make all tags searchable by the wordpress search function
- Preset custom fields
- get_post_meta shortcode returns empty field
- WordPress hide post from custom post-type on a single page
- Why Custom fields description is not working WordPress Version 5.4.2?
- Adding Custom Endpoint in WordPress Rest API
- General Term for this form Field
- How do I change the functionality of an image slider which is part of ACF?
- Make custom post types using ACF
- Problem Advanced Custom Fields PRO
- How to pass multiple custom fields as shortcode’s parameters
- Custom product page’s style for printing
- If I am not writing a theme, how do I add custom fields to a user for a plugin
- Taxonomy question
- How to get post that has non zero or greater than zero meta value
- Create Biographies
- WordPress doesn’t save a post revision when changing CMB2 custom fields
- How to add wordpress plugins in along with my standalone theme
- Add custom field for users
- How to Save settings of custom tab product page in admin side in a database?
- Changing the body of mail sent to new user registration
- Creating a user ‘add custom field’ section
- What method should I use for a sidebar widget that reads latest posts?
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- force category table refresh when adding new category
- Is there a way to add a custom input field for every taxonomy term in WP post editor?
- get_post_meta does not work
- Woocommerce custom fields
- ACF: Hide a div or template section when a custom field (in a field group) is empty
- How ACF Advanced Custom Field works with Woocommerce Single Product [closed]
- How do I add custom fields to the “Edit page” admin screen?
- Displaying Random Image from ACF Options Page [closed]
- A plugin for software reviews site like this one?
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Adding a variable to a meta field in the backend?
- ACF: Not displaying ACF data from another post
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- How to change data format in custom meta box field [closed]
- Links not opening as they should. Custom WP plugin
- Is there a plugin or another way that can help me find out the underlying files of a page/post? [closed]
- Order custom post type by posts with most likes first
- additional fields based on the quantity of products selected
- I am trying to add form using ACF plugin and acf_form() function, but my user fields dont show up properly
- how to compare date meta value in jet smart filter Date query?
- Issue using form in Google app in mobile
- How to filter posts with a wp query by a custom dropdown type field with the magic fields plugin
- Fields are not displayed on front end under custom php code in Advanced Custom Fields and Flexible Content field WordPress