我想包括一些HTML,特别是一个引导模式框。
这是我的HTML部分函数:
public function dmd_fav_modal_box() {
$content = \'<div class="modal fade" id="dmd_favorite_modal" tabindex="-1" role="dialog" aria-labelledby="dmd_favorite_modalLabel">
<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>
</div>
<div class="modal-body">
<p>Test</p>
</div>
<!--div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div-->
</div>
</div>
</div>\';
return $content;
}
在我的构造函数中,我尝试了一些过滤器和操作。E、 g。
add_action( \'wp_head\', array($this, \'dmd_fav_modal_box\') );
add_filter( \'the_content\', array($this, \'dmd_fav_modal_box\') );
但什么都不管用。谁能帮帮我吗?