Update:
Found the latest github version does this now. So, fixed!
Any thoughts on this?? Can’t find a solution anywhere.
I’m just trying to output it normally with the ‘the_field’ call.
Ok looked in the DB and compared the values of ‘VISA’ to that of what should be exactly the same: ‘MASTERCARD’. All code is the same, except the last bit:
VISA:
a:1:{i:0;a:3:{s:5:”field”;s:19:”field_522f7170dee44″;s:8:”operator”;s:2:”==”;s:5:”value”;s:3:”yes”;}}s:8:”allorany”;s:3:”all”;}s:8:”order_no”;i:1;}
MASTERCARD:
a:1:{i:0;a:3:{s:5:”field”;s:0:””;s:8:”operator”;s:2:”==”;s:5:”value”;s:0:””;}}s:8:”allorany”;s:3:”all”;}s:8:”order_no”;i:0;}
I don’t know what these codes mean. DO you see anything wrong, or why its different? The visa obviously has the ‘s:19:”field…..’ part that isn’t in the mastercard one…. but looking at the field group editor, they are set up exactly the same….
Definitely:
I have a number of radio button fields. They all have either ‘yes’ or ‘no’ as the value. Is there a way to say ‘if value = yes then *do whatever*’, meaning if the value is ‘no’ i dont want it to show at all.
DOes that make sense?
Would it be possible to use an if statement like:
if( $value == 'yes' ) {
//post the value
??
Or would it need to call an array first then use a $yes as the code?
Now to find an if statement to remove any radio buttons that have ‘no’ as their selection…
Figured it out!!
I took a chance and made an if statement based on what I thought was the radio button type (turned out to be ‘choices’) and it actually worked.
Here’s the code i used. So this calls all fields within a group, takes out any that doesn’t have a value, then puts an icon instead of a ‘yes or ‘no’ for the radio button, yet keeps all other fields loading like they normally do:
$group_ID = 6817;
$fields = array();
$fields = apply_filters('acf/field_group/get_fields', $fields, $group_ID);
if( $fields )
{
foreach( $fields as $field_name => $field )
{
$value = get_field( $field['name'] );
if ($field['choices']){
$map = array(
'yes' => '<i class="icon-ok"></i>',
'no' => '<i class="icon-remove"></i>'
);
$value = $map[ $value ];
} else {
}
if( $value ) {
echo '<li><b> ' . $field['label'] . '</b> ' . $value . '</li>';
}
}
Brilliant, that works!
Ok, so is there a way to call more than one group ID? Lets say i want to show all of group 123 and group 345 together? Do i just have to repeat this entire code for each?
Ok, but this won’t work with the code filtering out any fields that are not filled in, right?
That’s the
if( $field['value'] )
part from the original code above…
Perfect that worked excellently!
One other question.
Is there a way to filter out specific field groups with this code? I know there are ways to use the postID to show the groups, but what if we want to show all associated with a post, except one group?? Does that exist?
Hey Elliot,
I’m thinking that I don’t since I can’t get it to work. 🙂
New question/problem along these lines.
Just imported a CSV with a date field, in the format of ‘yymmdd’, and now the Datepicker doesn’t show anything on the admin editor page. Just a blank field. Save value is set to yymmdd, display is set to dd/mm/yy.
Just tested with a text field instead and the yymmdd value shows up. Any idea why the datepicker field will just show blank?
The save format is set to yymmdd
Looks like for some reason, I have to make the CSV’s date to be yyyymmdd and the save format to just the yymmdd which really doesn’t make sense, but it seems to have worked.
wells5609, thanks for the link!
what format did you use for multiple checkbox fields within the csv?
I read something like that and tried it but didn’t work…though it may have been in the wrong area…
I’ve been using WP Ultimate CSV Importer….could you recommend an importer plugin that you know allows that exploded values?
Update:
Server company changed the limits for php to the ones in the other post, as well as the htaccess and it still won’t save. Barring the chance that these updates are taking time to ‘sync’, any other thoughts on the cause?
I added in that htaccess code suggested in the other post and still having the problem.
Does this mean the only way to increase the amount of memory is to get the server company to increase it?
Update:
It seems like 63 is the max number of fields that will show on the Group’s edit page…I can create new fields above the very last one and it adds them but the very last one disappears….so is this a pagination issue? But then on the page “Custom Fields” page, it only shows 63 as the number of fields in that group…
Update: Tried a different browser and the problem still happened (just seeing if it was a cache thing).
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.