Support

Account

Home Forums General Issues Very annoyed with inserts for WYSIWYG. I've tried other solutions

Solved

Very annoyed with inserts for WYSIWYG. I've tried other solutions

  • Normal WYSIWYG wordpress allows you when you first create the field to say whether or not you want it to put out HTML or just pure text.

    Why can’t I do that with ACF WYSIWYG fields I add to a field group?

    I know how to strip the output of tags when I call it but this is an inelegant and hacky solution. There has to be a better way of doing things.

    I’ve also purchased ACF pro, so I can use more advanced features in there etc.

  • I’m not 100% clear on what you’re looking for.

    What to you mean by:

    Normal WYSIWYG wordpress allows you when you first create the field to say whether or not you want it to put out HTML or just pure text.

    I don’t have any knowledge of adding a wysiwyg field in WP other than using ACF to do it, so any documentation you can point me to would probably be helpful.

    ACF4 uses a different editor than the main WP editor. ACF5 uses the same editor. There is a significant difference between these two versions of the plugin. The developer is working on releasing a free version of ACF to WP some time this year.

  • I was thinking like this:
    image

    having looked at the documentation here: https://www.advancedcustomfields.com/resources/textarea/

    I think the thing I’m getting confused by is the difference between textarea and wysiwyg.

    Here’s the problem:

    I have a get_field php call inside of a p tag like this

    <p class="class-name"> get_field(etc etc); </p>

    And it outputs like this

    <p class=class-name> </>
    
    <p> 
     <ul>the content that I put into my field </ul>
       <li>content</li>
       <li>content</li>
       <li>content</li>
       <li>content</li>
     </p>
    
    <p> </p>

    Which is super ugly and no good.

  • Looking at the documentation here it seems that maybe the problem is that I’m using get_field ?

    https://www.advancedcustomfields.com/resources/get_field/

    What’s the difference in output between get_field and the_field on a WYSIWYG field?

    I also see that that there is the ability to call the field without formatting by saying get_field(‘field_name’, false, false). Am I understanding that correctly?

  • get_field() gets the value of the field. the_field() outputs the content of the field. Both functions format the value the same way, basically the same way that WP formats the value of the main content editor. For a WYSIWYG field, if you want to get the value without formatting the you need go do get_field('my_field', false, false). The second argument is the post ID, set to false it means the current post. The 3rd argument tells ACF not to format the value.

  • get_field('my_field', false, false)
    isn’t working for me. It isn’t outputting the weird <p> tags problem but it’s not outputting anything either. Not sure why. Oh well, I found a work around. I just wish for the future it was clearer how to wrap a WYSIWYG output with a div and class instead of getting this weird <p> tag error. This issue goes a long ways back in the forum, I can tell, but everyone just gets around it by stripping the tags using a function, but that doesn’t really address the fundamental issue as far as I can see.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Very annoyed with inserts for WYSIWYG. I've tried other solutions’ is closed to new replies.