This worked for me:
// Customize mce editor font sizes
if ( ! function_exists( 'wpex_mce_text_sizes' ) ) {
function wpex_mce_text_sizes( $initArray ){
$initArray['fontsize_formats'] = "10px 12px 13px 14px 16px 18px 20px 22px 24px 26px 28px 30px 32px 34px 36px 38px 40px 42px 44px 46px 48px 50px";
return $initArray;
}
}
add_filter( 'tiny_mce_before_init', 'wpex_mce_text_sizes' );
Found here: http://www.wpexplorer.com/wordpress-tinymce-tweaks/
How do you move the location of the font size drop-down menu on the tinymce toolbar, though?
Hello Elliot,
in your tutorial you say to transalte Field Groups and do nothing on Fields.
But in the WPML options I can’t find any “fields” option, just Fields Groups.
(screenshot: http://prntscr.com/6fep16)
Maybe this happens because I’m using the WPML Translation Management addon to use icanlocalize professional translations.
I’ve also marked as “translate” all the custom fields as you say in the part “avoid data loss”.
When I send to professional translators this contents, they are able to translate all the fields, and I get this fields translated in the WPML translations editor interface (screenshot: http://prntscr.com/6feo1g)
But If I open the post normally, in the standard WP edit interface, fields are not there (screenshot: http://prntscr.com/6feog9)
I understand that this is also a WPML issue and that they should help as well, but unfortunately any request about ACF in WPML forum is answered with this sentence “ACF is not in our compatibility list, you should use Types instead of ACF”…
Is there someone able to make repeater and flexible fields translatable by icanlocalize professionals?
It seems that the last version of WPML is causing this issue. There are a huge amount of support request on WPML forum after last update. They say to be aware about this and that they will fix the issue asap, maybe today. I really hope it’s not an ACF fault, I’m deeply in love with this plugin 🙂
Thanks for the info. Can you try hard refresh to make sure the correct JS is loaded? Your results seem quite odd, and are hopefully fixed by the correct JS.
Failing that, can you provide a login account and I’ll check it out
Thanks
E
For example, I have a custom post type that displays a video. That video is also a custom post type with custom fields. In order to associate the video with the post, I have a field called ‘video’ that is a Post Object. That way, I can just pick the video in a list to display on that post.
When I upgraded the plugin, the videos just stops showing up. When I revert the plugin, they work again. Actually, anything using a Post Object field – which there are quite a bit (Sliders, featured items…).
With 5.1.8 this will return a Post Object:
$post = get_post(60);
echo $post->post_title;
$fields = get_fields(60);
$video_post_object = $fields['video'];
$field = get_field('video', 60);
print_r($video_post_object); // WP_Post Object ( [ID] => 926 ... )
print_r($field);
In 5.2.X the video field is blank/null/whatever.
Field Name: video
Field Type: Post Object
Required: No
Filter by Post Type: Video
Filter by Taxonomy: –
Allow Null? No
Select Multiple? No
Return Format: Post Object
Conditional Logic: No
Video is one example, but all Post Objects return null with get_field/get_fields.
I should also note, the field groups are currently being setup in the admin section under the Custom Fields tab – so ACF is driving all of this.
Hi @korndev
You can loop over the rows by using jquery to find ‘.acf-row’
You can also find all sub fields by using the acf.get_fields function. Please note the second parameter is for a jQuery object to confine the search within. ie. if you pass the repeater jQuery object as this parameter, acf will return only fields found within this repeater object
I did some testing and it looks like in the upgrade from 4 to 5 any Field Groups (post_type==acf) are kind of cloned into a new post with post_type==acf-field-group
As I said in my original post I have a custom solution that involves storing the post IDs of field groups in a custom field. If I upgrade the project from 4 to 5 (which I’d really like to do) then the post IDs I have stored will still reflect the ACF4 ‘acf’ posts and not the ACF5 ‘acf-field-group’ posts.
During upgrade is there any reference made that links the ACF4 post ID to its upgraded ACF5 post ID? If so then I could write a query that would go through and update all of the post IDs.
OR
Is it possible to hook into the upgrade and update my post IDs then?
thanks!
temporary solution provided by @holblin but just a bit tidy.
add_filter(‘admin_footer’, function(){
echo “<script type=’text/javascript’>jQuery(‘#screen-options-wrap .metabox-prefs’).prepend(‘<input type=”checkbox” style=”display: none;”>’);</script>”;
});
Hello,
in my case i add custom style in Function.php
Maybe quick way and undestructive method ?
#categorydiv{ display: block !important;}
That seems to solve problem for me
http://support.advancedcustomfields.com/forums/topic/screen-options-must-be-checked-bug-or-feature/
troymcginnis
March 8, 2015 at 5:10 pm
Hello,
in my case i add custom style in Function.php
Maybe quick way and undestructive method ?
#categorydiv{ display: block !important;}
That seems to solve problem for me
Thanks Elliot. A quick test on my main problem site and it seems to be resolved. Will be doing more development on that site later today so I can test further.
I found that you can change the square brackets [] to {}, for example:
[otherShortcode attr="{acf field='field_name'}"]
but that didn’t work for me!
Any suggestions?!
I have confirmed that this fix does work on my website. When upgrading directly to this from an old version (5.1.9.1), I didn’t have to do anything however when upgrading from 5.2.0 I did have to manually reassign to the Tax Term like so: https://cloudup.com/cJTeIzG5uqJ.
Some more information. When making the field required in the field settings. Then the message will disappear after the first validation fails, but after you corrected it and it passes validation again, the error message will be cleared. But I don’t want all fields with custom validation to be required.
This fix (taken from another thread and thanks to Hoblin) does a perfect quick and dirty fix for now:
// fix for ACF PRO version 5.20
add_filter('admin_footer', function(){
echo '<script type="text/javascript">jQuery("#screen-options-wrap .metabox-prefs").prepend(\'<input type="checkbox" style=”display: none;">\');</script>';
});
Usually there is a Visual/text editor between the title and SEO editors
When I disable ACF the field shows up.
I hope this can get resolved soon…
I’ve been having some trouble with this as well. I have a “Upcoming Events” page, and a “Past Events” page. Each event has a custom field called “event_date”.
I want to create a loop that displays all of the events greater than today.
From what I’ve gathered in the three links above, I would put this in my functions.php file:
// CREATE UNIX TIME STAMP FROM DATE PICKER
function custom_unixtimesamp ( $post_id ) {
if ( get_post_type( $post_id ) == 'event_type' ) {
$event_date = get_post_meta($post_id, 'event_date', true);
if($event_date) {
$dateparts = explode('/', $event_date);
$newdate1 = strtotime(date('d.m.Y H:i:s', strtotime($dateparts[1].'/'.$dateparts[0].'/'.$dateparts[2])));
update_post_meta($post_id, 'unixstartdate', $newdate1 );
}
}
}
add_action( 'save_post', 'custom_unixtimesamp', 100, 2);
Then I would add something like this to my page template:
<?php
$today = time();
$args = array(
'post_type' => 'event_type',
'posts_per_page' => 5,
'meta_query' => array(
array(
'key' => 'unixstartdate',
'compare' => '>=',
'value' => $today,
)
),
'meta_key' => 'event_date',
'orderby' => 'meta_value',
'order' => 'ASC',
);
$query = new WP_Query( $args );
$event_type = $query->posts;
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
Right now that’s not turning up any results. My post-type is called “event_type”, and the key is “event_date”.
Any thoughts on where I’m going wrong?
This seems like what’s happening to me. I’m on ACF PRO 5.2.0. Any time that I check a taxonomy term, the metabox disappears. If I check two terms quickly, it will disappear and then reappear. Check three terms quickly, disappear, reappear, disappear. I can see it’s cycling between display:hidden and display:block on the categorydiv box.
Quick (and ugly) fix :
// fix for ACF PRO version 5.20
add_filter(‘admin_footer’, function(){
echo ‘<script type=”text/javascript”>jQuery(“#screen-options-wrap .metabox-prefs”).prepend(\'<input type=”checkbox” style=”display: none;”>\’);</script>’;
});
Quick (and ugly) fix :
// fix for ACF PRO version 5.20
add_filter(‘admin_footer’, function(){
echo ‘<script type=”text/javascript”>jQuery(“#screen-options-wrap .metabox-prefs”).prepend(\'<input type=”checkbox” style=”display: none;”>\’);</script>’;
});
Actually, the solution is right over here: http://support.advancedcustomfields.com/forums/topic/reverse-query-relationship-subfield-which-is-nested-in-a-repeater-field/
I should have googled better before posting. 🙂
“Yeah, log into your account, and click on the tag icon on the download button for your Pro download.”
–skweeze
It doesn’t work for me. :/
<?php $images = get_field('gallery_images');
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<div class="gallery_content_wrapper">
<a href="<?php echo $image['url']; ?>">
<div class="gallery_image_wrapper">
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</div>
</a>
</div>
<?php if ( function_exists('slb_activate') ){
$content = slb_activate($content);
}
echo $content; ?>
<?php endforeach; ?>
<?php endif; ?>
In case anyone needs a quick, dirty fix: I added the following CSS block to the acf-global.css file to force show all of the respective ACF fields in the editor (less than ideal, but a temp fix).
.acf-postbox {
display: block !important;
}
Thanks, @Elliot
One more question. If we use {type: ‘repeater’} is there then an easy way to loop through each of the repeater rows/objects so we’re are relying on the classes to find things?
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.