• This code makes me open an iframe in a modal:

    <a data-toggle="modal" data-target="#myModal">
      OPEN MODAL
    </a>
    
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog" style="width: 80%">
        <div class="modal-content">
    
          <div class="modal-body">
              <iframe src="https://getbootstrap.com/getting-started/" width="100%" height="580" frameborder="0" allowtransparency="true"></iframe>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
          </div>
        </div>
      </div>
    </div>

    I’m modify this wordpress template. In section “Portfolio”, clicking on the icon in the photo, it opens another page. I want to make this page to open inside the iframe.

    ORIGINAL CODE

    $foutput.='
    <div class="mega-hover">
    <a target="_blank" href="'.$page_url.'">
       <div class="mega-hoverlink"><i class="fa fa-link"></i></div>
    </a>';

    MY CODE:

    $foutput.='
    <div class="mega-hover">
    
    <!-- MY MODAL ADD IN LINK -->
    <a data-toggle="modal" data-target="#MYMODAL">
     <div class="mega-hoverlink"><i class="fa fa-link"></i></div>
    </a>';

    The above code calls the modal.

    This is the modal code:

    <div class="modal fade" id="MYMODAL" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
     <div class="modal-dialog" style="width: 80%">
       <div class="modal-content">
          <div class="modal-body">
           <iframe src="'.$page_url.'" width="100%" height="100%" frameborder="0" allowtransparency="true"></iframe>
           </div>
          <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
           </div>
         </div>
      </div>
    </div>

    The problem is that the modal does not find the page ‘.$page_url.’. As I reviewed the code, the variable $foutput stores all information as mounting html / structure of divs, buttons, links, etc.

    I tried to create a variable with the modal code, and end of code I put a return, but but without success.

    How can I do this? How do I open the iframe ‘.$page_url.’

Viewing 1 replies (of 1 total)
  • Thread Starter dev999

    (@dev999)

    I can not open an iframe in a modal. The problem is that I can not put the iframe to find the variable $foutput which is a plugin code.

Viewing 1 replies (of 1 total)
  • The topic ‘How to open an iframe in a modal a wordpress template’ is closed to new replies.