Atanas Angelov
Forum Replies Created
-
Forum: Plugins
In reply to: [Carbon Fields] Add fields to posts from specific categoryHi @css0101 ,
Please refer to the documentation: https://carbonfields.net/docs/containers-conditional-display/ .
Also, in order to receive more timely help you should consider posting issues on GitHub as we monitor them much closer (https://github.com/htmlburger/carbon-fields/issues).
Forum: Plugins
In reply to: [Carbon Fields] How to install CF as library w\o composer?Hi @css0101 ,
Please refer to the “Without Composer” section on the “Plugin Quickstart” page of the documentation here:
https://carbonfields.net/docs/carbon-fields-plugin-quickstart/Forum: Plugins
In reply to: [Carbon Fields] Отсчет Х днейYou can get the field value using this function:
$date = carbon_get_the_post_meta( 'crb_start_site );
Then you need to convert it using a library such as nesbot/carbon (https://carbon.nesbot.com/docs/#api-difference)
- This reply was modified 7 years ago by Atanas Angelov.
Forum: Plugins
In reply to: [Carbon Fields] Отсчет Х днейHello @garri83,
Unfortunately, we only provide support in English – could you please post your message again in English?
Forum: Plugins
In reply to: [Carbon Fields] Content disappear from templates after upgrade to 2.0Hi @issuesinc ,
2.0 brings in a lot of breaking changes but we have an upgrade guide to help you out in migrating to it:
https://carbonfields.net/docs/carbon-fields-upgrade-guide/?crb_version=2-0-0You can also view the list of new features here:
https://carbonfields.net/docs/carbon-fields-new-features/?crb_version=2-0-0Forum: Plugins
In reply to: [Carbon Fields] carbon fields and menu edit screenI’m not really sure if this is what you need but you can restrict access to containers based on the current user ID, role or capabilities using this set of conditions:
–current_user_id
–current_user_role
–current_user_capability
https://carbonfields.net/docs/containers-conditional-display/?crb_version=2-0-0
https://carbonfields.net/docs/containers-condition-types/?crb_version=2-0-0Forum: Plugins
In reply to: [Carbon Fields] carbon fields and menu edit screenHi @stardeuche ,
Currently you can add containers to menu items but not menus.
As a work around, you can create a Theme Options page which lists all menus and dynamically creates a select field of all terms for every menu, e.g.:
$fields = array(); $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); foreach ( $menus as $menu ) { $fields[] = Field::make( 'select', 'menu_' . $menu->term_id . '_term', 'Category for "' + $menu->name + '"' ) ->add_options( $your_menu_terms_array_here ); } Container::make( 'theme_options', 'Menu Categories' ) ->add_fields( $fields );
NOTE: the above code is an example and has not been tested.
Forum: Plugins
In reply to: [Carbon Fields] Ajaxify fieldI’m not exactly sure what you are doing exactly but keep in mind that conditionally created fields will be created conditionally when a user visits the site as well (not only for admin requests) and you cannot get a field’s value if the field has not been defined for the current request (2.0+).
Forum: Plugins
In reply to: [Carbon Fields] Ajaxify fieldHi @magicpriest ,
Thank you for the kind words!
> I’m wondering is there any way to load data as select field value through ajax or any other way
Currently, such functionality is not supported in core but if you are familiar with React you could write your own extension field for this purpose (https://carbonfields.net/docs/extending-extending/?crb_version=2-0-0).
If you are looking for a quick and dirty solution, you could hack in a simple select using jQuery which updates its options when a field’s value changes by utilizing the appropriate event in the JavaScript API (https://carbonfields.net/docs/advanced-topics-javascript-api/?crb_version=2-0-0) but you’ll have to handle it’s own data saving and loading.
Forum: Plugins
In reply to: [Carbon Fields] Accessing data from complex fieldsThe code you’ve sent uses different fields than the one you mentioned earlier and it does not include the var_dump you also mentioned.
I can’t really debug remotely based on tickets with bits and pieces of the information – I will need a reproduce case in order to investigate further.
Forum: Plugins
In reply to: [Carbon Fields] Accessing data from complex fieldsYour database records look OK but I noticed you said your
var_dump
was in functions.php – is it inside a hook or directly in functions.php? Note that you cannot pull field values beforeCarbon_Fields::boot()
is called so if you callboot()
in a hook and then attempt to pull a value before that hook has executed you will not get the results you expect.To test if this is the case try calling the
carbon_get_post_meta()
function in your header.php, for example.> … will not be able to utilize version 2 at all?
CF 2 will pull legacy data but it will not be able to make complex queries based on legacy data, for example. The database records you showed are in 2.0 format so you should not have problems with that.
Forum: Plugins
In reply to: [Carbon Fields] Accessing data from complex fieldsHi @tinothepro ,
Can you paste all database meta keys (and their values) for the post in question that start with “_crb_services” ?
Note that advanced features such as queries or fetching nested field values on legacy data is not supported (legacy data is automatically converted to “modern” data when you save it – there is not migration script at this time). Getting the root complex field value is NOT an advanced feature so there may be an underlying issue here.
Forum: Plugins
In reply to: [Carbon Fields] compatibility with the last version of wordpressHi @stardeuche ,
Can you let us know what exactly does not work for you and which version of Carbon Fields you are using?
If you are receiving an error please specify the exact error as well.Forum: Plugins
In reply to: [Carbon Fields] problem with a custom field of user profileYour problem is not really in the scope of Carbon Fields as it’s related to WordPress admin columns.
I’d suggest you check out the WordPress admin column documentation or find a suitable admin column plugin/library.
Forum: Plugins
In reply to: [Carbon Fields] problem with a custom field of user profileHi @stardeuche ,
You’ve missed to add the priority and number of arguments in your add_filter() call – it should be like this:
add_filter('manage_users_custom_column', 'add_content_entite_users', 10, 3);
You must always specify the number of expected arguments if your filter function expects more than 1 argument.
Also you should move the carbon_get_user_meta() call to be inside the if() so you do not get the meta for every column but just for the column you need, like so:
if($column_name == 'entite') { $user = carbon_get_user_meta( $user_id, 'crb_entite_utilisateurs' ); echo $user; }
This makes the final code look like this:
function add_content_entite_users($value, $column_name, $user_id) { if($column_name == 'entite') { $user = carbon_get_user_meta( $user_id, 'crb_entite_utilisateurs' ); echo $user; // NOTE: you should probably return $user, not echo } return $value; } add_filter('manage_users_custom_column', 'add_content_entite_users', 10, 3);
- This reply was modified 7 years, 4 months ago by Atanas Angelov.