Custom HTML field with iframe code

Support General Custom HTML field with iframe code

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31372
    artur.art7@gmail.com[email protected]
    Participant

    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>

    #31383
    Long NguyenLong 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 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.