简体   繁体   English

在 Wordpress 3.4 中使用 add_theme_page

[英]Using add_theme_page in Wordpress 3.4

I am trying to add a Theme options page, and this is the piece of code i am using..我正在尝试添加一个主题选项页面,这是我正在使用的一段代码。

add_theme_page('Theme Options', 'Theme Options', 'read', 'theme-option-slug' , 'theme_settings_page');

I am wondering what does the 'read' in the list of parameters mean.我想知道参数列表中的“读取”是什么意思。 Also, If I replace it with Administrator, it does not work.另外,如果我用管理员替换它,它就不起作用。

What all values Can I use to replace the 'read'.我可以使用哪些所有值来替换“读取”。 I read on Wordpress CodeX, it is the field for Capability.我在 Wordpress CodeX 上阅读,它是能力领域。 But, entering options like Editor , Administrator , etc in the function does not work.但是,在函数中输入EditorAdministrator等选项不起作用。

So, I need to know the exact value of the code I can use....所以,我需要知道我可以使用的代码的确切值......

The Codex has some useful information on what each parameter is, and how it works.Codex有一些关于每个参数是什么以及它如何工作的有用信息。 As for the 'read' value, you're pretty close in knowing that it's a type of capability that allows only certain users to see that given page.至于“读取”值,您几乎知道它是一种仅允许特定用户查看给定页面的功能。

Unfortunately, you can't define a Role to determine who can and cannot see your page.不幸的是,您无法定义角色来确定哪些人可以看到您的页面,哪些人不能看到您的页面。 You have to define a Capability .您必须定义一个Capability If you only want somebody with administrative privileges to see your page, you need to select a capability that is unique to the Administrator Role.如果您只希望具有管理权限的人查看您的页面,则需要选择管理员角色独有的功能。

Change 'read' to something like 'create_users', and that should do what you need.将“read”更改为“create_users”之类的内容,这应该可以满足您的需求。 This Table should help you. 这张表应该对你有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM