I talked to Elliot and he will include the additional filter for acf_the_content into the next version of ACF.
I found a solution so that ACF creates the correct code from a WYSIWYG field. You only have to add
add_filter( 'acf_the_content', 'wp_make_content_images_responsive' );
to your functions.php. I hope Elliot will add this direct into the code, so that ACF filters the WYSIWYG content like WP does.
For the image field this code works for me:
$image = get_field('my_image');
$img_src = wp_get_attachment_image_url( $image['id'], 'full' ); $img_srcset = wp_get_attachment_image_srcset( $image['id'], 'full' ); ?>
<img src="<?php echo esc_url( $img_src ); ?>"
width = "<?php echo $image['sizes']['Stripe-width']; ?>"
height = "<?php echo $image['sizes']['Stripe-height']; ?>"
srcset="<?php echo esc_attr( $img_srcset ); ?>"
sizes="(max-width: 100vw) 480px" alt="<?php echo $image['alt']; ?>"
>
You can modify the toolbars with the acf/fields/wysiwyg/toolbars
filter like this
function my_toolbars( $toolbars ) {
$toolbars['Full'] = array();
$toolbars['Full'][1] = array('bold', 'italic', 'underline', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'alignjustify', 'link', 'unlink', 'hr', 'spellchecker', 'wp_more', 'wp_adv' );
$toolbars['Full'][2] = array('styleselect', 'formatselect', 'fontselect', 'fontsizeselect', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' );
// remove the 'Basic' toolbar completely (if you want)
unset( $toolbars['Basic' ] );
// return $toolbars - IMPORTANT!
return $toolbars;
}
add_filter('acf/fields/wysiwyg/toolbars' , 'my_toolbars');
Hope this helps
You can modify the toolbars with the acf/fields/wysiwyg/toolbars
filter like this
function my_toolbars( $toolbars ) {
$toolbars['Full'] = array();
$toolbars['Full'][1] = array('bold', 'italic', 'underline', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'alignjustify', 'link', 'unlink', 'hr', 'spellchecker', 'wp_more', 'wp_adv' );
$toolbars['Full'][2] = array('styleselect', 'formatselect', 'fontselect', 'fontsizeselect', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' );
// remove the 'Basic' toolbar completely (if you want)
unset( $toolbars['Basic' ] );
// return $toolbars - IMPORTANT!
return $toolbars;
}
add_filter('acf/fields/wysiwyg/toolbars' , 'my_toolbars');
Hope this helps
Maybe my new plugin would help
http://support.advancedcustomfields.com/forums/topic/multisite-relationship-field/
Maybe my new plugin would help
http://support.advancedcustomfields.com/forums/topic/multisite-relationship-field/
Maybe my new plugin would help
http://support.advancedcustomfields.com/forums/topic/multisite-relationship-field/
I got the same error using a relationship field. I removed blocks from my code until the errors going away. The setup_postdata($post)
causes this error but the code is still working and shows the_title()
or the_permalink()
.
That surprises me because in the example code it says “This example uses a function called setup_postdata which will override the global $post object and allow functions such as the_title to target the selected post.”
Hope this helps
Thomas
I may be wrong, but the Flexible Content/Repeater Field is wrapped in a table and therefore a layout mode like any other field group only with CSS is not possible.
@Hube2 thanks for this idea. I got this to work in the backend – but I still don’t know how to solve this for the frontend.
I don’t want to load all CSS files for each font; I want to load the CSS file depending on the selected font.
Take a look at this page where Elliot shows how to set up options pages within ACF 5
http://www.advancedcustomfields.com/resources/features/options-page/
Thanks Elliot,
this helped me and now I have a great overview over my Flexible Content elements.
Thomas
Yes I contact the developer team of Admin Column View also and they know about this problem.
Thanks
Thomas
It would be great if you share your Icon Library field.
Thanks
Great solution and it works!
@elliot
I have done the same with the new Options Page plugin and you should change it there, too.
Would it not it be better to define a separate textdomain for the plugin (e.g. ‘acf-options-page’). Thus, potential conflicts with the ACF textdomain would not occur.
I have done the German translation for the Options Page plugin (with the current textdomain ‘acf’) and enclosed it to this post. If you will change the textdomain, please let me know.
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.