我试图将一个插入到页面上的短代码中,但是当我尝试将其插入模态弹出窗口时,它根本无法渲染。
<div id="thanks" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Redeem Points</h4>
</div>
<div class="modal-body">
<?php echo do_shortcode['go_greenredempoints'];?>
</div><!-- End of Modal body -->
</div><!-- End of Modal content -->
</div><!-- End of Modal dialog -->
</div><!-- End of Modal -->
这是我的插件中的show form例程:
function show_form(){
echo "<form class='form-horizontal' class='contact' name='redemmpointsForm' id='redemmpointsForm' >";
echo " <div class='form-group'>";
echo "<h3>You may only redeem the maxium points of : <?php echo $maxpoints;?></h3>";
echo "<input type='hidden' name='playerid' value='<?php echo $playerId;;?>' />";
echo "<input type='number' valuemax='<?php echo $maxpoints;?>' name='points' id='points' class='form-control' placeholder='How many points do you wish to redeem.' />";
echo "<label class='control-label col-md-4' for='Comments'>Comments?</label>";
echo "<input type='text' name='comments' />";
echo " </div>";
echo " <div class='form-group'>";
echo " <div class='col-md-6'>";
echo " <input type='button' class='btn btn-success' name='submit' id='submit' Text='Submit'>";
echo " <a <a href='#' class='btn' data-dismiss='modal'>Close</a>";
echo " </div>";
echo " </div>";
echo "</form>";
}
我将我的短代码定义为
add_shortcode( 'go_greenredempoints', 'gs_redeemplugin' );
function gs_redeemplugin() {
ob_start();
show_form();
return ob_get_clean();
}
?>
答案 0 :(得分:1)
您的短代码为main = do
(command:args) <- getArgs
let result = lookup command dispatch
print $ fmap (const args) result
。因此,在使用[go_greenredempoints]
函数时,请尝试以下操作:
do_shortcode