Bootstrap 模态 Wordpress 中未显示短代码

Short Code not showing in Bootstrap Modal Wordpress

我正在尝试将一个插件放入一个短代码中,它可以在页面上运行,但是当我尝试将它插入一个模式弹出窗口时,它根本无法正确呈现。

<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 -->

这是我的插件中的展示表单例程:

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();
    }
?>

您的简码是 [go_greenredempoints]。所以当使用 do_shortcode 函数时试试这个:

<?php echo do_shortcode('[go_greenredempoints]'); ?>