Custom Fields
Re-Envisioned
Support General Custom HTML field with iframe code

  • Creator
    Topic
  • #31372

    Hi,
    I would like to put a different iframe field on every website. I have created a custom field but when I choose text area or other field looks like on the attachment after the <script> rest oh the code is visible on frontend website.

    When I choose custom HTML the field is not available screenshot also in the attachment.

    Screen

    <div>
    <div id="salesmanago-Iframe_e6f9b551-ca43-4b16-a9e6-2d4f9c95be1e"></div>
    <script>
    (function() {
    var smIframeParentElem = document.getElementById("salesmanago-Iframe_e6f9b551-ca43-4b16-a9e6-2d4f9c95be1e");
    var smIframeElem = document.createElement("iframe");
    smIframeElem.src = "https://www.salesmanago.pl/mscf/3v8e84qpbrdlvrt9/default/ENG-BCGLOBALAPPS-MDMS.htm?" + Date.now() + '"';
    smIframeElem.style.margin = "0";
    smIframeElem.style.padding = "0";
    smIframeElem.width = "500";
    smIframeElem.height = "650";
    smIframeElem.style.overflowY = "hidden";
    smIframeElem.style.overflowX = "hidden";
    smIframeElem.style.maxWidth = "100%";
    smIframeElem.style.background = "transparent";
    smIframeElem.style.border = "none";
    smIframeParentElem.appendChild(smIframeElem);
    }());
    </script>
    </div>

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #31383
    Long Nguyen
    Moderator

    Hi Artur,

    The field custom_html does not save the value in the database, so the helper function rwmb_meta() won't render the code on the frontend. You can use the field textarea or wysiwyg and bypass the sanitization to add any HTML tags. Refer to this documentation https://docs.metabox.io/sanitization/

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.