WordPress 3.5 新增加了一个提醒框性能,能够创立一个提醒框,而后指向任何元素,比方下边的例子:
本文就来教你怎样创立一个这样的提醒框。
首先需求增加提醒框的脚本,这样能力应用提醒框的 JS 办法。
//挂载提醒框脚本 function Bing_admin_pointer_enqueue_scripts(){ wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); } add_action( 'admin_enqueue_scripts', 'Bing_admin_pointer_enqueue_scripts' );
而后应用 pointer() 办法创立一个简略的提醒框:
/** *WordPress 后盾增加提醒框 *http://www.endskin.com/admin-help-box/ */ function Bing_add_pointer_scripts(){ $content = '<h3>请设置主题</h3>'; $content .= '<p>请为新主题进行简略的配置!'; ?> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready(function($){ $('#menu-appearance').pointer({//能够指向任何元素 content: '<?php echo $content; ?>', position: { edge: 'left', align: 'center' }, close: function(){ //提醒框关上之后做的事件 } }).pointer('open'); }); //]]> </script> <?php } add_action( 'admin_print_footer_scripts', 'Bing_add_pointer_scripts' );
综合代码:
/** *WordPress 后盾增加提醒框 *http://www.endskin.com/admin-help-box/ */ function Bing_add_pointer_scripts(){ $content = '<h3>请设置主题</h3>'; $content .= '<p>请为新主题进行简略的配置!'; ?> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready(function($){ $('#menu-appearance').pointer({//能够指向任何元素 content: '<?php echo $content; ?>', position: { edge: 'left', align: 'center' }, close: function(){ //提醒框关上之后做的事件 } }).pointer('open'); }); //]]> </script> <?php } add_action( 'admin_print_footer_scripts', 'Bing_add_pointer_scripts' ); //挂载提醒框脚本 function Bing_admin_pointer_enqueue_scripts(){ wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); } add_action( 'admin_enqueue_scripts', 'Bing_admin_pointer_enqueue_scripts' );
以上就是安达网络工作室关于《给WordPress的编辑后台添加提示框的代码实例分享》的一些看法。更多内容请查看本栏目更多内容!
wordpress经过以后文章的ID获取文章的信息用的极多,在wordpress二次开发中,上篇文章说过,获取以后文章id...
1.用分类做为导航拦 <?php wp_list_categories('depth=2&title_li=0&orderby=name&show_count=0');?> 把这句...
首先到Flash MP3 Player 的主页上下载该顺序。解紧缩之后,将 mp3player.swf 和 ufo.js 两个文件放到效劳器...
register_sidebar()(创立侧边栏) 建设一个侧边栏,用来搁置小工具。这个函数应用的时分请放在一个函数里,...
WordPress 简码是一品种似于论坛标签的货色,格局相似于把尖括号换成中括号的 Html 标签。简码很多人叫做短...
要害字形容:理由 ZBLOG 装置 优化 工夫 WordPress 能够 文章 博客 让我据守ZBLOG的十二大理由: ...