Has there been any progress on this? I have a repeater field with a minimum of 2 items and in the repeater a WYSIWYG block, which have default (some Lorem ipsum text) and when I add a block to the Gutenberg editor a completely empty block is shown. If I click the editor and edit the content the preview becomes visible.
The code above does nothing for me (or do I need to change some values to my field names?)
I made a screencast to better illustrate the issue. As you can se when you edit the block it becomes visible
https://www.youtube.com/watch?v=IzM-OMoHbWQ
It has been awhile and I was thinking that this shouldn’t be to difficult and the basic function isn’t!
I created a small function that creates a button for each flexible field on the page and when clicked it toggles the .-collapsed
class to the fields. I’ve not tested this in depth, but adding this to your functions.php
gives you the basic feature.
https://gist.github.com/mvaneijgen/41fbf1088c5fbc3b948c481cdea93dd8
I’ll be testing this out and if there are any changes I’ll update this gist
I’m looking for something similar. It would be nice if there was an option to have them collapse by default.
This overview is much cleaner and easier to edit
@mrdigitalau I use emojis (important only in the labels, not IDs) to distinguish them
The pro version download history can be found here:
https://www.advancedcustomfields.com/my-account/ click on “See all versions”
the free version download history can be found here (scroll down and select any version you want (this works for any WordPress hosted plugin)):
https://wordpress.org/plugins/advanced-custom-fields/advanced/
@a[email protected] veel geluk
Same issue, also seems random on which site what bug occurs.
Fixed my single data issue also. The data I got back from my previous function looked like
a:6:{i:0;s:3:"112";i:1;s:4:" 113";i:2;s:4:" 114";i:3;s:4:" 115";i:4;s:4:" 111";i:5;s:4:" 116";}
Take a note to the spaces, the spaces resulted in incompatible data. To fixed this I changed the line in the function $values = explode(",", $checked);
to $values = explode(", ", $checked);
and now the data looked like:
a:6:{i:0;s:3:"114";i:1;s:3:"113";i:2;s:3:"116";i:3;s:3:"115";i:4;s:3:"111";i:5;s:3:"112";}
No spaces!
I had changed the fields Return Format
from Post Object
to Post ID
and now some of the code works! The only issue is that it will only save the first item that is checked and all item after that will be ignored.
Thank you for your reply.
Because I wanted some sort of custom order and not have it completely random, I created this function
https://gist.github.com/mvaneijgen/f169750f01f3677ccda34d12dd89dc93
I would just like it to share and have this issue resolved. What I did was create a list of fields I wanted to see in the email (not all the fields are relevant) and have them in the order seen in the array $arrayKeysOldItems
next I compared the $_post['acf']
array stored in $arrayKeysNewItems
and had them ordered the same as the previous array. Than I just looped through all the items in the first array and compared them with the values of the new array and if they were different I add them to the email.
In my final code I also do some converting of sting to date
and time
stamps because not all the values are in the same way stored, but that would just clutter up this code.
Thanks again for your feedback! Seems like a much easier solution!
@hube2 thanks this seems like a solution.
I thought maybe ACF had some hooks to check if the upload is going through a file field and than you could set the max upload to the ACF max upload size on the file and else set a default, something like this https://gist.github.com/mvaneijgen/4db072899ae54ef7469519b50f5ddacc but maybe that is just wishful thinking.
Thanks again.
I think I need to elaborate on my question more and there for I made some screenshots:
This is what I would like to see, my field labels
are in dutch, but I like to code in English so my field names
are in English, but It is hard to know what the field name
is when looking at it in the post edit page. To figure out what it is called I have to open the edit.php?post_type=acf-field-group
and than find the field I am looking for. What would be amazing is if there was an option the have it in light grey next to it for Admin users.
@ash It seems your code works, but I don’t get how to remove certain items from the results. Could you maybe shed some light on this. I now have the following text in my excerpt that shouldn’t be there.
…1
content
image
355
…1481800527:2
1
content
357
…1481637174:1
1
content
three_columns
These are just some random terms sprinkled to different search results
and here is what a search result looks like (sorry in dutch)
…1481637174:1 1 content three_columns Onderwijs Alle kinderen zijn welkom De 26 schoollocaties van Spaarnesant verzorgen openbaar onderwijs, toegankelijk voor alle kinderen op basis van respect voor alle mogelijke…
@hube2 well, that solved the issue. Thanks.
@hube2 sorry for the late reply, but you know busy and stuff and the client was ok with the filtering being based on the month for now.
But I now have revisited the issue and renamed the field date
to photo_date
of which I am sure there is no duplicate of, but the issue still persists
a copy of the data I use can be found here:
https://docs.google.com/spreadsheets/d/1t3LD1z83DsHgA_SzvYxLk_4dzrrtYd0iRyx7sK7GzWk/edit#gid=0
And if you want to look at the data being in use check it out here”
http://www.pletterij.nl/foto-archief/
I have no idea why it’s happening, but maybe you see something obvious.
I am probably over simplifying it, but the default insert/edit link
option that is also available in the WYSIWYG editor seems like the perfect solution. It would be great to use this because clients are already familiar with this interface (see screenshot).
If I want to wrap this in a button I have to give them a different UI to accomplice the same thing. First a checkbox do you want a button? Next do you want a external or internal button? Than the button title, button url and if it should open in a new tab or not, all this is all caught in the simple interface that WordPress is already providing.
@eaglejohn isn’t it better to create a ticket from this topic? There are several people here all with experience using other plugins or code to solve this issue and if where all going to create a ticket that sounds a bit redundant and a lot more hassle to shift through.
@eaglejohn yeah, maybe. This is the first thing you see when you Google the idea and seeing that the WordPress default behaviour is exactly what we need and the developers saying that it is a great idea. For now I will be using this plugin https://wordpress.org/plugins/acf-link/ like @emrl suggested
I want to stay in this loop to get email notification there for +1 from me to
I created a function based on a Stack overflow answer (can’t find the page anymore otherwise I would have linked to it).
function get_darker_or_light_class_based_on_hex ( $hex_color ) {
$hex = str_replace( '#', '', $hex_color );
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
if($r + $g + $b < 450){
$class = 'dark-bg';
}else{
$class = 'light-bg';
};
return $class;
}
I had to change the 450
value to get it to work with my colors. And in my template part I use <?php echo get_darker_or_light_class_based_on_hex(get_sub_field('bg-color'); ?>
to get the right background class.
Hope someone finds this usefull.
Could it be that date
is already used by the default wordpress date and and naming the field completely differed like photo_archive_date
would fix the problem?
If so could you rename the field and have all the content in the field update with it?
This is my field (sorry in Dutch):
This is the loop
<?php $args = array(
'post_type' => 'foto_archief',
'orderby' => 'meta_value_num',
'meta_key' => 'date',
'order' => 'ASC',
'posts_per_page' => -1
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<h3><?php the_title(); ?></h3>
<p><?php echo get_field('date'); ?></p>
<?php endwhile; endif; wp_reset_postdata(); ?>
And this is what the list looks like
I am using Version: 5.4.8
I got:
$args = array(
'post_type' => 'foto_archief',
'orderby' => 'meta_value_num',
'meta_key' => 'date',
'order' => 'ASC',
'posts_per_page' => -1
);
but it only filters on month
so I got first jan
than feb
ect… but the years and dates are all over the place.
My input date is 10/20/2016
and my output date is 24 januari, 2011
Found it with the help of a user in wpnl.slack.com here is a gist https://gist.github.com/mvaneijgen/3158c2ef88d7585776bcaaeae1d2f804
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.