htmlBurger
Forum Replies Created
-
Forum: Plugins
In reply to: [Carbon Fields] how to recover the image field in my front office ?Can you add an additional
Textfield in the sameContainer, fill-in some text and then try to output it usingcarbon_get_post_meta()? This will help us understand whether the issue is associated only with theImagefield or with all available fields.Forum: Plugins
In reply to: [Carbon Fields] Google Map ApiKeyGoogle Maps changed their policy and since the 22nd of June, they don’t allow requests without an API key.
More information about the change can be found here – Building for Scale: Updates to Google Maps APIs Standard Plan
Hope this answers your question.
Forum: Plugins
In reply to: [Carbon Fields] Google Map ApiKeyHi @mvshandor,
Adding a new
set_apikey()method on theGoogle Maps Fieldwill require you to have a duplicate code, if you have multiple fields of this type.Instead, we have added a new filter called “carbon_map_api_key”, which allows you to define your Google Maps API key. For example:
add_filter( 'carbon_map_api_key', 'crb_google_maps_api_key' ); function crb_google_maps_api_key() { return ''; // Your API Key goes here }This change will take place in the next version of Carbon Fields. In the meantime, feel free to download and use the latest release from https://github.com/htmlburger/carbon-fields.
Forum: Plugins
In reply to: [Carbon Fields] api key for google mapHi @dewy,
We have added a new filter called “carbon_map_api_key”, which allows you to define your Google Maps API key. For example:
add_filter( 'carbon_map_api_key', 'crb_google_maps_api_key' ); function crb_google_maps_api_key() { return ''; // Your API Key goes here }This change will take place in the next version of Carbon Fields. In the meantime, feel free to download and use the latest release from https://github.com/htmlburger/carbon-fields.
Forum: Plugins
In reply to: [Carbon Fields] how to recover the image field in my front office ?Hi @dewy,
The code that you are using seems correct.
Can you please confirm that
get_the_ID()returns a valid value and you have set an image to the custom field on the “References” post that you are trying to display?You could compose different complex fields in the following way:
https://gist.github.com/emohamed/399a3c7188e737086d8a5a2d16a8a3e1
The above approach defines different panels for each unique combination of blocks you need.
Let us know if this works for you.
Forum: Plugins
In reply to: [Carbon Fields] Displaying image fieldHi @alexadark,
Glad to hear that you managed to solve the issue.
Please, let us know if you need further assistance.
Forum: Plugins
In reply to: [Carbon Fields] Load carbon fields with theme if plugin is not activeHi @anniesp04,
The best way to include Carbon Fields in a theme is to load it with Composer (https://getcomposer.org). You can add
htmlburger/carbon-fieldsas a composer dependency in thecomposer.jsonfile and then load Composer’s autoload file in thefunctions.phpfile of your theme. For example:add_action( 'after_setup_theme', 'crb_setup_theme' ); function crb_setup_theme() { include_once( __DIR__ . '/vendor/autoload.php' ); }If you are having difficulties using Composer, you can copy Carbon Fields to your theme (e.g. in folder
libs) and then load is using the following code:add_action( 'after_setup_theme', 'crb_setup_theme' ); function crb_setup_theme() { // check if Carbon Fields is not already installed if ( ! class_exists( '\\Carbon_Fields\\Field\\Field' ) ) { require( __DIR__ . '/libs/carbon-fields/carbon-fields-plugin.php' ); } }Please, let us know if you’re having further issues.
Forum: Plugins
In reply to: [Carbon Fields] Displaying checklist and radio contentYep, that will do the job.
Forum: Plugins
In reply to: [Carbon Fields] problem with slug home pageHi @dewy
Glad to hear that you managed to resolve the issue.
We will update the documentation to make it more clear that
show_on_pagecan also accept page IDs, so thanks for bringing that to our attention!Forum: Plugins
In reply to: [Carbon Fields] Displaying checklist and radio contentYou can checkout the documentation about “Accessing field values”, there are a few examples there how to get the values of complex and normal fields.
Forum: Plugins
In reply to: [Carbon Fields] Displaying checklist and radio contentThen these fields are accessible in the complex loop, you just need to check them and add your logic. For example:
<?php if ( $tabs = carbon_get_the_post_meta( 'house_reps', 'complex' ) ): ?> <ul class="tabs card grey lighten-5"> <?php foreach ( $tabs as $tab ): ?> <?php if ( $tab['rep_none'] === 'no' ): ?> <li class="tab col s12 disabled red lighten-4"><a href="#none">None</a></li> <?php else: ?> <li class="tab col <?php echo carbon_get_post_meta(get_the_ID(), 'house_reps_tabs'); ?>"> <a href="#<?php echo sanitize_title_with_dashes( $tab['rep_last_name'] ); ?>"> <?php echo $tab['rep_last_name'] . ' (' . carbon_get_post_meta(get_the_ID(), 'state_abb') . '-' . $tab['rep_cong_dist_num'] . ')' ?> </a> <?php if ( $tab['rep_verified'] ): ?> <div class="verified">Verified!</div> <?php endif ?> </li> <?php endif ?> <?php endforeach ?> </ul> <?php endif ?>Forum: Plugins
In reply to: [Carbon Fields] Displaying checklist and radio contentHi @darktakua,
Are
rep_verifiedandrep_nonepart of a complex field?Forum: Plugins
In reply to: [Carbon Fields] Complex Fields Separate ContentYou are welcome!
Closing the ticket, if you have more questions, consider opening a new one.
Happy coding 🙂
Forum: Plugins
In reply to: [Carbon Fields] Complex Fields Separate ContentIf you have two complex fields that are somehow related, you can declare 2 variables before the actual logic and check them afterwards, for example:
$reps = carbon_get_the_post_meta( 'reps', 'complex' ); $senators = carbon_get_the_post_meta( 'senators', 'complex' ); if ( $reps && $senators ) { // additional logic and html goes here }