[wordpress插件] Add Admin JavaScript添加管理员JavaScript

wordpress 插件 文章 2020-01-29 10:20 606 0 全屏看文

AI助手支持GPT4.0

评分

96

96

描述

Ever want to introduce custom dynamic functionality to your WordPress admin pages and otherwise harness the power of JavaScript?

是否想将自定义动态功能引入WordPress管理页面,或者利用JavaScript的功能?

Any modification you may want to do with JavaScript can be facilitated via this plugin.

您可以通过此插件来方便您对JavaScript进行的任何修改。

Using this plugin you’ll easily be able to define additional JavaScript (inline and/or by URL) to be added to all administration pages.

使用该插件,您可以轻松定义要添加到所有管理页面的其他JavaScript(内联和/或URL)。

You can define JavaScript to appear inline in the admin head, admin footer (recommended), or in the admin footer within a jQuery jQuery(document).ready(function($)) {} section, or

您可以定义JavaScript以内联方式显示在admin标题,admin脚注(推荐)或jQuery jQuery(document).ready(function($)){} 部分的admin脚注中,或

reference JavaScript files to be linked in the page header.

引用要在页面标题中链接的JavaScript文件。

The referenced JavaScript files will appear in the admin head first, listed in the order defined in the plugin’s settings.

引用的JavaScript文件将首先出现在管理头中,并按照插件设置中定义的顺序列出。

Then any inline admin head JavaScript is added to the admin head.

然后,将任何内联管理员头JavaScript添加到管理员头。

All values can be filtered for advanced customization (see Filters section).

可以过滤所有值以进行高级自定义(请参阅过滤器部分)。

Links: Plugin Homepage |

链接:插件主页 |

Plugin Directory Page |

插件目录页面 |

GitHub |

GitHub |

Author Homepage

作者主页

Hooks

挂钩

The plugin exposes four filters for hooking.

该插件公开了四个用于挂接的过滤器。

Typically, code making use of filters should ideally be put into a mu-plugin or site-specific plugin (which is beyond the scope of this readme to explain).

通常,理想情况下,应该将使用过滤器的代码放入mu插件或特定于站点的插件中(这不在本自述文件的解释范围内)。

Bear in mind that most of the features controlled by these filters are configurable via the plugin’s settings page.

请记住,这些过滤器控制的大多数功能都可以通过插件的设置页面进行配置。

These filters are likely only of interest to advanced users able to code.

这些过滤器可能只对能够进行编码的高级用户感兴趣。

c2c_add_admin_js_files (filter)

c2c_add_admin_js_files(过滤器)

The ‘c2c_add_admin_js_files’ filter allows programmatic modification of the list of JavaScript files to enqueue in the admin.

通过“ c2c_add_admin_js_files”过滤器,可以以编程方式修改JavaScript文件列表,以便将其排入管理员。

Arguments:

参数:

    • $files (array): Array of JavaScript files.
    • $ files(数组):JavaScript文件数组。

    Example:

    示例:

    /** 

      / ** 

    * Adds a JavaScript file to be enqueued in the WP admin. 

    *添加一个要在WP管理员中排队的JavaScript文件。 

    * @param array $files Array of files. 

    * @param array $ files文件数组。 

    * @return array 

    * @返回数组 

    */

    * /

    function my_admin_js_files( $files ) {    

    函数my_admin_js_files($ files){    

    $files[] = 'http://ajax.googleapis.com/ajax/libs/yui/2.8.1/build/yuiloader/yuiloader-min.js';    

    $ files [] ='http://ajax.googleapis.com/ajax/libs/yui/2.8.1/build/yuiloader/yuiloader-min.js';    

    return $files;

    返回$ files;

    }

    }

    add_filter( 'c2c_add_admin_js_files', 'my_admin_js_files' );

    add_filter('c2c_add_admin_js_files','my_admin_js_files');

    c2c_add_admin_js_head (filter)

    c2c_add_admin_js_head(过滤器)

    The ‘c2c_add_admin_js_head’ filter allows customization of the JavaScript that should be added directly to the admin page head.

    “ c2c_add_admin_js_head”过滤器允许自定义应直接添加到管理页面标题的JavaScript。

    Arguments:

    参数:

      • $js (string): JavaScript code (without

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Affiliates-CRC会员-CRC
[wordpress插件] Block User Ads屏蔽用户广告
[wordpress插件] CC SliderCC滑块
[wordpress插件] Category Banner Management for WoocommerceWoocommerce的类别横幅管理
[wordpress插件] Typing Effect打字效果
随便看看
大佬们,如何将现有H5如何转成小程序啊?有什么不用手动转的方法啊 605
公众号调用客服消息接口发送小程序卡片多次报错? 312
公众号调用客服消息接口发送小程序卡片多次报错,求大佬帮忙看看啊! 498
你好,你的小程序涉及收集、使用和存储用户个人信息? 2668
小程序如何隐藏地图的比例尺? 612
云数据库请求数据如何算的? 340
小程序违规都不能申诉了吗? 480
js中出现 Cannot read property 'play' of nul? 734
第三方平台有什么方法可以给旗下创建的小程序关联公众号码?或者生成公众号? 308
域名已经提交备案,但是在添加服务器的域名的时候 提示域名未备案? 477