On my page, I have many fields text area fields containing text, and one WYSIWYG field containing a YouTube video (I need it to be WYSIWYG because otherwise only the URL of the video would show, not the video itself).
Problem: my text area fields have no tags other than br tags in them, whereas my WYSIWYG is full of p tags, creating layout misalignments.
If I remove p tags from the WYSIWYG field containing the video (using $strip = array(‘
‘,’
‘); echo str_replace($strip,”,$field);), then the iframe of the video becomes invisible, meaning it’s there but it’s gray in Firebug and doesn’t show on the page.
Any suggestions?
You can try using
wp_oembed_get
and a textfield. You add the youtube url in the textfield.Assuming the field name is
youtube_url
, your code will be something like:you can create text type field in Advance custom field