WordPress:如何在任何管理页面上显示元框? [英] WordPress: How to show a metabox on any admin page?

查看:28
本文介绍了WordPress:如何在任何管理页面上显示元框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经知道如何为帖子、页面和自定义帖子类型注册元框,但我想注册一个元框以显示在我的自定义管理页面上,这不是帖子.

I already know how to register metaboxes for Posts, Page, and Custom Post Types, but I would like to register a metabox to be shown on my custom admin page, which is not a post.

我的插件在 WordPress 管理员中有一个选项页面"——我想显示元框在这个页面上.

My plugin has an "Options Page" in the WordPress Admin – I would like to show metaboxes on this very page.

这可能吗?如果是,如何实现?

Is this possible? If yes, how can this be acheived?

我在 add_meta_box 文档中看到其中一个$post_type 参数的可能值是 dashboard,但是这在任何地方都没有记录.我想它会在 WordPress 仪表板(登录时的主管理屏幕)上显示元框,但这不是我需要或想要的.

I saw in the add_meta_box documentation that one of the possible values for the $post_type parameter is dashboard, however this is not documented anywhere. I guess it would show the metabox on the WordPress Dashboard (the main admin screen when logging-in), but this is not what I need or want.

这个问题是关于 OptionTree Metaboxes,它使用标准的 WordPress Metaboxes.也许有更好的方法可以通过不同地使用 OptionTree 或修改 OptionTree 来实现这一点?请参阅此相关问题: 如何拥有多个主题选项";带有 OptionTree 的页面?

推荐答案

如果我的理解是正确的,您可以按照以下操作

if my understanding is right you can do it by following

这是一个演示插件,可以帮助您使其正常工作.

Here is a Demo plugin that can help you get it working.

这个 WordPress 插件演示了如何构建自己的插件使用 WordPress 提供的可拖动元框的页面,需要WordPress 2.7 版本,支持 WordPress 2.8 更改装箱布局引擎

This WordPress Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine

这篇关于WordPress:如何在任何管理页面上显示元框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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