WordPress的上下文帮助是指会出现在Wordpress后台指定页面右上角的帮助信息,示例代码如下:
- function sl_contextual_help( $contextual_help, $screen_id, $screen ) {
- if ( ‘product’ == $screen->id ) {
- $contextual_help = ‘<h2>产品发布/编辑页面帮助信息</h2>
- <p>索凌网络提示:请在这里输入Wordpress的上下文帮助信息!</p>’;
- } elseif ( ‘edit-product’ == $screen->id ) {
- $contextual_help = ‘<h2>产品列表页面帮助信息</h2>
- <p>索凌网络提示:请在这里输入Wordpress的上下文帮助信息!</p>’;
- }
- return$contextual_help;
- }
- add_action( ‘contextual_help’, ‘sl_contextual_help’, 10, 3 );
上述代码加入functions.php之后,你点击产品列表页面的右上角的帮助,会看到设置的帮助信息:
点击产品发布/编辑页面右上角的帮助,会看到设置的相应的帮助信息:
Leave a Reply