Gravity form popup with bootstrap modal
- 发表于
- WordPress
放进functions.php文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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">×</span></button> <h4 class="modal-title" id="myModalLabel">'.$title.'</h4> </div> <div class="modal-body"> '.do_shortcode('[gravityform id="'.$id.'" title="false" description="false" ajax="true"]').' </div> </div> </div> </div> '; } add_shortcode('gf_popup', 'gf_popup_shortcode'); |
原文连接:Gravity form popup with bootstrap modal
所有媒体,可在保留署名、
原文连接
的情况下转载,若非则不得使用我方内容。