Gravity form popup with bootstrap modal

function gf_popup_shortcode( $atts, $content = null  ) {

	extract( shortcode_atts( array(
		'title' => '',
		'id' => '',
		'text' => '',
	), $atts ) );

	return '
        <a class="gf-form-modal-trigger" href="" data-toggle="modal" data-target="#gf-popup-modal'.$id.'">'.$text.'</a>
        <div class="modal fade" id="gf-popup-modal'.$id.'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">'.$title.'</h4>
                    <div class="modal-body">
                        '.do_shortcode('[gravityform id="'.$id.'" title="false" description="false" ajax="true"]').'
add_shortcode('gf_popup', 'gf_popup_shortcode');

Leave a Reply

Your email address will not be published. Required fields are marked *