@hube2 John Huebner
I am a big fan of you and your ACF addon plugins..
I actually took one of your plugins and made a new ACF Post Status addon out of it!
here: https://github.com/samjco/acf-show-field-by-status-rules
Maybe one day we may cross paths at a WordCamp or something! =)
Ok thanks!! John..
This is what works!!
function on_post_save( $post_id) {
//Get previous values.
//$prev_values = get_fields( $post_id );
//Get submitted values.
//$values = $_POST['acf'];
$post = get_post( $post_id );
$output = apply_filters( 'the_content', $post->post_content );
if($output):
$post_content = html_entity_decode($output);
$dom = new DomDocument();
@$dom->loadHTML($post_content);
$attachment_ids = array();
foreach ($dom->getElementsByTagName('a') as $item) {
$attachment_ids[] = $item->getAttribute('data-id');
}
//var_dump($attachment_ids);
// die();
if($attachment_ids):
update_field('field_63a6bd5d2a3d2',$attachment_ids, $post_id);
else:
update_field('field_63a6bd5d2a3d2',"", $post_id);
endif;
else:
//clear all attachments if no content is available
update_field('field_63a6bd5d2a3d2',"", $post_id);
endif;
}
add_action('acf/save_post', 'on_post_save', 10);
Ok I see.. and yes that field actually exists..
I guess i see because when I do a vardump I see that the load dom is parsing the ids. It’s just when it gets to the part to update the fields is what’s not working.
Does acf/save_post have these parameters: $post_id, $post
Or would I have to called for globals?
Now it seems as if PHP8 doesn’t support Imagemagick or Ghostscript…
So I end up using a paid version ($20) to show my PDF thumbnails that doesn’t use modules called https://wp-pdf.com
It works with ACF upload field and the render template code as well as @jonas code!!
Having the same issue.
It was working but stopped.
Save Terms works.
Load terms do not work.
I am using version 5.9
Thank Huebner!!!
You always seem to come through!! A real ACF trooper!
I think you meant to add the code to a code element… 🙂
@eduardo-marcolino
You should consider renaming your plugin to Custom Database Table for ACF Fields.
When I first saw this I thought it was an HTML table.
Thanks John.
SO acf-input.js starting at Line 9700 is where the Conditional Logic is happening..
There is also where certain fields are allowed.
If we can simply hook into the js functions and add our custom field to the array I guessing this should work in custom fields.
About the radio/checkbox fields. I think there should be a setting that allow users to assign a image instead of a check or a dot.
Kinda like:
Choices:
red : Red : /images/red.png
yellow : Yellow : /images/yellow.png
Hmm, assets/acf-input.js
Line(s) 9700, 9920 and other fieldtype lines … Add manually add it the custom field type there.
I am wondering if there a way to add the custom field type to the array on runtime??
I would think that this should be a main feature with the radio field.
Thanks John.
And I am familiar with that post. But I want to use conditional logic.
Ha Ha….. after all these years!!
You finally implemented it!
https://www.advancedcustomfields.com/resources/register-fields-via-php/
Thanks Elliot!
Number 5.
Addon to show all field variables of your field groups!
https://github.com/samjco/ACF-PHP-VARS
Problem Solved!
Addon to show all field variables of you field groups!
https://github.com/samjco/ACF-PHP-VARS
Addon to show all field variables of you field groups!
https://github.com/samjco/ACF-PHP-VARS
I started working on this addon!!!
I’ll be done today!
Thanks for the input!
About the first question Tabs for Field groups…
I usually use a plugin called Tabify
https://wordpress.org/plugins/tabify-edit-screen/
However it would be kinda nice to include in ACF.
Move a field.
I didn’t know I can move in and out of repeatable, flexible fields 🙂
It would be very nice to be able to move it in and out of field groups.
Even Muting or disabling a field would be nice because sometimes I want to keep the field but disable it from being used.
Any thoughts on add sliders and on/off button to replace the true/false or sliders for numbers?
Thank you for all other responses!
Well would you be interest in simply creating a checkbox “Enable variable PHP output”?
IF box is checked and user goes to export PHP, it will print the variable version.
I can copy and paste, but I use the export feature alot and having to rework all field arrays into variable working ones, would take all day each time.
I am pretty sure the ACF community would support this idea. It’s for the advanced coder and will give all sort of creation power to any coder, thus broadening the flexibility of this already awesome product called ACF!
E,
Please consider the potential of having this added, like, using the ACF Option add-on to globally control the elements.
Just to be clear :).
I was only speaking on the way the PHP export prints out.
Not a major change in variables/function etc. 😛
I would think you would only use 2 variables:
$acf_all_fields[]
$acf_field_group_multi_array
Besides, I don’t think the PHP export wouldn’t confuse us.
The only difference would be each array group will terminate with ; instead of , .
With this we can do custom conditions using php!
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.