Hi Elliot,
Maybe editor wasn’t the right word, because visual composer is more a page builder, but I would like similar functionalities within a Advanced custom field like for example the wysiwyg field.
My client doesn’t like (and doesn’t know how) to work with shortcodes and it would be nice to have the ability to drag and drop to make, for example, two text columns.
Regards,
Joeri.
Steps to reproduce
Hi @Bondra
The normal WP WYSIWYG is not availing in ACF due to limitations within the repeater field.
If you are using the WYSIWYG field OUTSIDE of a repeater field / flexible content field, you can install an add-on I created that uses the WP WYSIWYG and offers the native visual / text tabs:
http://www.advancedcustomfields.com/add-ons/wordpress-wysiwyg/
Thanks
E
Hi @Till
Thanks for the info.
For some reason, your toolbars are not being added to the wysiwyg
JS object. Normally, an array of toolbars will exist at acf.fields.wysiwyg.toolbars
(this.toolbars
).
On line 115 of core/controllers/input.php
you will see:
acf.fields.wysiwyg.toolbars = <?php echo json_encode( $t ); ?>;
It is possible that this line of script is not being run due to a JS error on the page. Can you check for any JS errors?
Perhaps also do some PHP debugging to make sure line 115 is correct data?
Thanks
E
Sure! See below. Need anything else?
this.toolbars
: undefined
this.o
:
{
id: "wysiwyg-acf-field-field_52ba5d6289438_0_field_52ba64a564a1b-52fd8bc9b44f6"
toolbar: "full"
upload: "no"
__proto__: Object
}
Hi @Till
Thanks for the bug report. The full line is:
if( acf.helpers.isset( this.toolbars[ this.o.toolbar ] ) )
And it looks like the isset function is not working as per expected.
Is it possible that your WYSIWYG field contains a ‘toolbar’ setting that does not exist anymore?
Thanks
E
Thanks for the info but I am still unable to replicate this issue on my end running the latest WP, ACF and repeater field. How are you with JS debugging? Are you able to look through the input.min file (search for the WYSIWYG part) and do some testing there.
@tomfordweb – did you have any luck tracking down the issue?
Thanks
E
I’m having the same issue. I’m running WP 3.8.1, ACF 4.3.4 + Repeater Field 1.1.1. No console errors. The add media button appears (and works!) but no WYSIWYG.
I’ve deactivated all plugins and reactivated only ACF + repeater. No change.
WordPress is installed in a subdirectory, but that’s nothing new I guess.
I’ve noticed problems on some other of my sites too. Did they already switch to Tiny MCE 4.0 in 3.8.1? Might that be causing the problem. I know the API has changed…
Hi @flowbob
It is most likely that you have a plugin which is adding the lightbox effect to WYSIWYG galleries. Is this correct?
if so, all you will need to do is pass the ACF value through the the_content
filter – this is how a plugin would modify the_content value.
<?php
$wysiwyg = get_field('field_name', false, false);
echo apply_filters('the_content', $wysiwyg);
?>
Please note the extra false, false
parameters are to prevent ACF from formatting the value because the_content
will also do this.
Thanks
E
I’m having the same problem–the main content is being replaced with a WYSIWYG field. I have 3 custom WYSIWYG fields, using both Basic and Full toolbar, none of which allow images. Seems to be the same situation for me — the replacement happens after editing and updating the WYSIWYG in full screen mode. Will try to verify a pattern as well.
I found this previous post:
http://support.advancedcustomfields.com/forums/topic/wysiwyg-field-showing-as-textarea/
I’m going to give this a try and report back.
Hi @tomjhume
The WYSIWYG field uses a filter called acf_the_content
. It is much the same as the_content
Thanks
E
Hi @Coug
ACF does create a hidden ‘WYSIWYG’ field in the wp_footer. You can will see a hidden div at the bottom of the page. If you change the display
property of this div, you can then see the WYSIWYG field.
Can you check to see if the image is being inserted into this field?
Thanks
E
The problem is that i’m not only getting image URLs, i’ve got a field with a WYSIWYG editor which gives me all kinds of content, so i can’t hardcode it in my template :/
Thanks Elliot. Maybe a feature for the future?
Sure, a WYSIWYG field would work…though it’s a bit heavy-handed just to insert an image. You mention I might need to add another field to allow for custom size selection. Any chance you can steer me in the right direction for how to do that?
Thanks as always for your amazing work and awesome support.
Hi @dadra
I do agree, however, the image field only saves the attachment ID and no other data.
You may need to add another field to allow for a custom size selection, or use a WYSIWYG field to insert the image with such data.
Thanks
E
Indeed, it appears the ACF Location Field add-on has a conflict…
Deactivated everything but when i activate ACF Location Field, the WYSIWYG appears with no toolbar and the following text which i didn’t ever type:
<p><br data-mce-bogus=”1″></p>
Google Map Field (which i only recently realised was added) seems to be a replacement for the older ACF Location Field anyway, so maybe this isn’t a big issue.
I did so. Still no errors. I made a screenshot. The field in the middle should be a wysiwyg.
Hi @sem90
Thanks for the clarification. The setting for ‘Run filter “the_content”’ has been removed in v4 as it caused many issues such as the one you are describing.
Basically, the ‘the_content’ filter should only be run once on a page, and running this multiple times can caused various errors with 3rd party plugins and themes.
Your options are to upgrade to ACF v4, or disable the option and add this code to your template:
<?php do_shortcode( get_sub_field('wysiwyg_field_name') ); ?>
Thanks
E
Thanks for reply and apologies for the large chunk of code. I did take large portions of the code out (the entire bit for the slider, the code for counting the boxes). Unfortunately this did not make a difference.
What I mean by filter, is the option under the ACF field settings, which says: “Run filter “the_content”?. Enabling this filter to use shortcodes within the WYSIWYG field”
As soon as I select ‘No’ all the rows from the repeater fields appear on the website. Obviously this does also mean that my entered shortcodes are now not executed, but they show up as [shortcode] etc. When I enable this filter (so setting on ‘yes’), the shortcodes work. When I now enter normal html data into the rows, they keep working fine.
The problems begin when I enter a shortcode in any of the rows from my repeater field. Now instead of all rows showing up on the front-end, only the first row is loaded regeardless of it’s content. If I enter a shortcode on the first row, the shortcode works fine and it displays the correct item on the front-end. But as soon as a shortcode in any row of my repeater,no other rows but the first row is loaded on the front-end.
So the problem somehow seems that shortcodes break the loop after it’s first round – but I can’t figure out why this is happening!
I am actually thinking of working on something similar. A button in the wysiwyg editor that would show you all the custom fields under your options page.
So you could easily enter global values without having to know your how to write the shortcode.
Let’s start with a ref,I am trying to follow tutorial:http://www.advancedcustomfields.com/resources/tutorials/creating-a-front-end-form/
Clarifiaction when I say I am setting 'post_id' => $post->ID
to a specific number i mean changing this to 'post_id' => 464
found on permalink AND added $options variable to the same file of the themes’templates’ php code.
That works, however you normally need to set the post_id from a page that queries wp_query and comes up with $post=>ID
. You also normally need not to use the <?php the_post(); ?>
and instead add a textarea or WYSIWYG to actually change the content&title.( i guess with the html_after_fields property/attribute)
It is extraordinary and seems improbable that you took spended so much effort to render acf_form and not have included standardfields, so please check your referrences and documentation for any hints or refferences
I also needed to display a list of posts with an edit link to point to the page using the template that will ‘fetch’ the $post=>ID
Here are your answers to the above questions:
However only if i set post id to a number on the template.Is this automated?
I don’t know what you mean by post id to a number on the template
. Please be specific
I mean If i make a wpquery to fetch a post on the page, will the template take over and automate editing? I guess yes but awaiting for your answer…
Sorry, I don’t understand what you mean by will the template take over and automate editing
. Please be specific
Also can you give an example of a standard field html to use in ‘html_after_fields’ say the content field.(Why use the_post when you want to show it editable?)
I don’t understand what you mean by (Why use the_post when you want to show it editable?)
I don’t have any code on hand to offer you to create a custom WYSIWYG editor, you will need to research this and add it to the html_after_fields parameter
Thanks
E
Actually, this causes a conflicting problem because I originally applied it to one custom field section, which worked, but now other different ACF WYSIWYG field sections that need line breaks are having their breaks removed. 🙁
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.