在Word preSS ADD_ACTION功能 [英] add_action function in wordpress

查看:586
本文介绍了在Word preSS ADD_ACTION功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以及即时学习,创建字preSS插件
我下载了一个,读codeS,我看到这个
我以为'富'是它会增加行动标签..

well im learning to create a wordpress plugin i downloaded one and read the codes, and i saw this i assume 'foo' is the tag where it will add action to..

但什么是数组()究竟做什么?

but what does the array() exactly do?

add_action('foo', array('foo1', 'foo2'));

我看着 HTTP://$c$cx.word$p $ pss.org / Function_Reference / ADD_ACTION
并有关于它没有明确的定义。

i looked at http://codex.wordpress.org/Function_Reference/add_action and there is no clear definition about it ..

推荐答案

右键,第一个参数是标签(到您将添加的动作),第二个参数指定要调用的函数(即你的回调)。

Right, the first argument is the tag (to which you'll be adding the action), and the second argument specifies the function to call (i.e. your callback).

第二个参数发生在一个PHP回调,正因为如此,接受多种有效形式。检查了这一点对所有的人:

The second argument takes in a PHP callback, and as such, accepts a number of valid forms. Check this out for all of them :

PHP回调伪类型

您在上面显示的类型为类型2的数组的第一个元素指定一个类,第二个元素指定你想调用类的哪个功能。

The type you've shown above is of type 2. The first element of the array specifies a class, and the second element specifies which function of the class you'd like to call.

因此​​,与您在上面的例子中,什么,会做的是,每当富()动作被调用,它最终将调用 foo1-方式> foo2的()以及

So with the example you've given above, what that will do is that, whenever the foo() action is called, it will eventually call foo1->foo2() as well.

这篇关于在Word preSS ADD_ACTION功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆