短代码在引导模式下不工作,为什么不呢?

时间:2015-10-31 作者:csharpdude77

我试图把一个pluign放进一个简短的代码中,它可以在页面上工作,但当我试图将它插入一个模式弹出窗口时,它根本无法正确呈现。

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

1 个回复
SO网友:sb0k

您的代码错误,请更改

<?php echo do_shortcode[\'go_greenredempoints\'];?>
使用

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

相关推荐