htmlBurger
Forum Replies Created
-
Forum: Plugins
In reply to: [Carbon Fields] Complex Fields Separate ContentMay I ask, is there a way to check for multiple carbon_get_the_post_meta?
@darktakua, about the field checks, you have to write the checks yourself, there is no other way.
In addition, I was wondering what the sanitize_title_with_dashes did?
sanitize_title_with_dashesis just a WordPress function that is used to slugify text. You can read more about it in the WordPress Codex: https://codex.ww.wp.xz.cn/Function_Reference/sanitize_title_with_dashesAlso, thanks so much for the help! 😀 You guys have made a great plugin.
Glad to help!
Forum: Plugins
In reply to: [Carbon Fields] Complex Fields Separate ContentI think I understand now, you are trying to add content to the tabs and the above code is only for the tabs navigation, is that correct?
To add the tab content you can try the following:
Add a new rich text field to the complex for the actual tab content
Field::make( 'rich_text', 'rep_description', __( 'Description' ) )Update the front-end to use the new field (this is just an example, you have to ajust it based on your project requirements)
<?php if ( $reps = carbon_get_the_post_meta( 'reps', 'complex' ) ): ?> <ul class="tabs-nav"> <?php foreach ( $reps as $rep ): ?> <li class="tab col s6"> <a href="#<?php echo sanitize_title_with_dashes( $rep['rep_last_name'] ); ?>"> <?php echo $rep['rep_last_name'] . ' (' . $rep['rep_state_abb'] . '-' . $rep['rep_dist_num'] . ')' ?> </a> </li> <?php endforeach ?> </ul> <ul class="tabs-content"> <?php foreach ( $reps as $rep ): ?> <li class="tab-content" id="<?php echo sanitize_title_with_dashes( $rep['rep_last_name'] ); ?>"> <?php echo wpautop( $rep['rep_description'] ); ?> </li> <?php endforeach ?> </ul> <?php endif ?>Hope this helps.
Forum: Plugins
In reply to: [Carbon Fields] Complex Fields Separate ContentHi @darktakua
I’m not sure I fully understand your problem. Are you trying to figure out how to approach the complex field front-end representation?
If that’s the case, here is some example code that might help you:
<?php if ( $reps = carbon_get_the_post_meta( 'reps', 'complex' ) ): ?> <ul> <?php foreach ( $reps as $rep ): ?> <li class="tab col s6"><a href="#<?php echo sanitize_title_with_dashes( $rep['rep_last_name'] ); ?>"> <?php echo $rep['rep_last_name'] . ' (' . $rep['rep_state_abb'] . '-' . $rep['rep_dist_num'] . ')' ?> </li> <?php endforeach ?> </ul> <?php endif ?>Forum: Plugins
In reply to: [Carbon Fields] Non-dev “pre-sales” questionsThanks!
Forum: Plugins
In reply to: [Carbon Fields] Non-dev “pre-sales” questions@sc0ttkclark I’ve forked and updated spreadsheet here: https://docs.google.com/spreadsheets/d/1fMl-6fy14CPK40j6hTPqgpMycpiTTl3ifupEBgewlb4/edit#gid=3
Please let me know if you need additional information.
Forum: Plugins
In reply to: [Carbon Fields] Non-dev “pre-sales” questionsHi there!
We’ve tried to create a fair comparison between Carbon Fields, ACF, and CMB2 here: https://carbonfields.net/about/
I know ACF has it’s own way of saving custom fields in DB, which seems to demand more queries then, for instance, CMB2.
Carbon Fields saves single row in the database per custom field value. So, we’re closer to CMB2 way of doing things than ACF.
How does CF relates to the forthcoming WordPress Fields API?
We’ll probably see how we can integrate Carbon Fields with the WordPress Fields API once it’s merged in the core. At this point we’re standing by until there is a release candidate that we can play with.
Forum: Plugins
In reply to: [Carbon Fields] Problem with nested complex fieldsHey George,
The issue has been fixed: https://github.com/htmlburger/carbon-fields/commit/bdfd68795d0b97df87cf13ac7842b842b09675af
Since a new version will not be released right away, feel free to use the latest version from GitHub.
Thank you for reporting the issue, and good luck with your project.
Hi Caspie,
Thanks for pointing that out. It appears there was an error in our documentation. We’ve fixed the error, adding another underscore for the field name prefix: https://github.com/htmlburger/carbon-fields-docs/commit/171b9b5bb89cce504c0956e2f9856542c32c8f27
Also, we’ve emphasized the fact that the field name is prefixed with an underscore in the relationship filters documentation.
In addition, the automatic prefixing with an underscore is already pointed out in the Fields -> Usage article in our documentation: https://carbonfields.net/docs/fields-usage/ and it includes a link to explanation why we prefix the fields with an underscore.
Thank you!
Forum: Plugins
In reply to: [Carbon Fields] Problem with nested complex fieldsHey George,
We were able to reproduce the issue with the complex fields.
We’ll work on fixing the issue the next few days.
Thank you for reporting.
Forum: Plugins
In reply to: [Carbon Fields] Problem with nested complex fieldsThis is a PHP limitation, actually. You’re probably hitting the
max_input_varslimit of PHP, because of too many input fields being submitted in one request.To clarify, such issues can occur if you have hundreds of variations in a product in WooCommerce, for example.
Fortunately, you can increase this limit in your php.ini: http://php.net/manual/en/info.configuration.php#ini.max-input-vars
Please, let us know if you have further issues.
Forum: Plugins
In reply to: [Carbon Fields] Problem with nested complex fieldsThanks, we’ll have a look at the problem ASAP.
Forum: Plugins
In reply to: [Carbon Fields] Problem with nested complex fieldsYes, it is the master branch.
You can use GitHub to clone and pull it, or if you’re not familiar with Git, you can download it az a ZIP archive.Forum: Plugins
In reply to: [Carbon Fields] Problem with nested complex fieldsHi George,
Thanks for the thorough report!
The issue has already been fixed in the development version. In case you need it right now, you can pull it from the GitHub repo of the plugin.
In case you need details about how we fixed it, head over to the PR page: https://github.com/htmlburger/carbon-fields/commit/e3c09b5dc99c1df860a9de93766f827dbaae3607
We’ll soon release a new version, containing this fix as well.
Thank you, and good luck with your project.
Forum: Plugins
In reply to: [Carbon Fields] default value of type dateHowdy, @digitalthinkgers,
The Carbon Fields in the frontend is not a natively supported feature.
It can be done, but it requires some custom coding. It has been discussed here as well: https://ww.wp.xz.cn/support/topic/carbon-based-front-end-forms?replies=4
Regarding default value of a date, this is easy – just call
->set_default_value( date( 'Y-m-d H:i:s' ) )on the field after creating it withmake()orfactory().Thank you.
Howdy @knath632,
Image and file fields save the ID of the attachment by default. In the backend they display the URL of the file just for presentation purposes, for convenience, but still, the ID is stored.
The ID is better for storage, as it allows to fetch a lot of other information for the attachment, including the URL of the file.
In case you want to store the URL, you can use the
->set_value_type( 'url' )method, as documented here: https://carbonfields.net/docs/fields-image/