daniel-w
6/10/2015 - 5:04 PM

Add a modal window with a gravity form that can by dynamically populated based on the current post.

Add a modal window with a gravity form that can by dynamically populated based on the current post.

<?php if ($status != 'sold') : ?>
  <a href="#" class="mgButton" data-toggle="modal" data-target="#featModal">Book A Viewing</a>
<?php endif ?>

<div class="modal fade" id="featModal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title"> Request About <?php the_title(); ?> </h4>
      </div>
      <div class="modal-body">
        <?php $property = get_the_title(); ?>
        // property is a parameter name set in the gravity field form options
        <?php gravity_form(1, false, false, false, array('property' => $property), true); ?>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->