此插件的作用与您正在查找的相同:http://wordpress.org/extend/plugins/magic-action-box
它有一个名为action-box
但有不同类型的操作框,可以在创建新操作框时选择。您想要的代码可以在插件的目录中找到lib/classes/ProsulumMabAdmin.php
.
寻找方法add_actions()
最后,你会发现这样的东西:
/**
* Hacky part followed from Premise. This is to make sure people
* select an Action Box type before an Action Box type is actually created.
* Requirements as of WP3.3: Custom post type needs to have support for comments
* for this hack to work
*/
add_action(\'admin_notices\', array( &$this, \'possiblyStartOutputBuffering\' ) );
add_filter(\'wp_comment_reply\', array( &$this, \'possiblyEndOutputBUffering\' ) );
遵循代码-或者根据需要复制它和mod,这就是开源的全部内容:)-您应该能够创建弹出选项页来选择事件类型。
但是,你也需要catch 事件类型的选择。要了解Magic Action Box是如何实现的,请再次查看该方法add_actions()
并寻找
add_action( \'admin_init\', array(&$this, \'processSubmissions\' ) );
按照代码进行操作,您将在
processSubmissions()
处理操作框类型选择的方法。