本文整理汇总了PHP中add_posts_page函数的典型用法代码示例。如果您正苦于以下问题:PHP add_posts_page函数的具体用法?PHP add_posts_page怎么用?PHP add_posts_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_posts_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edcal_list_add_management_page
function edcal_list_add_management_page()
{
global $edcal_supports_custom_types;
if (function_exists('add_management_page')) {
$page = add_posts_page(__('Calendar', 'editorial-calendar'), __('Calendar', 'editorial-calendar'), 'edit_posts', 'cal', 'edcal_list_admin');
add_action("admin_print_scripts-{$page}", 'edcal_scripts');
if ($edcal_supports_custom_types) {
/*
* We add one calendar for Posts and then we add a separate calendar for each
* custom post type. This calendar will have an URL like this:
* /wp-admin/edit.php?post_type=podcasts&page=cal_podcasts
*
* We can then use the post_type parameter to show the posts of just that custom
* type and update the labels for each post type.
*/
$args = array('public' => true, '_builtin' => false);
$output = 'names';
// names or objects
$operator = 'and';
// 'and' or 'or'
$post_types = get_post_types($args, $output, $operator);
foreach ($post_types as $post_type) {
$page = add_submenu_page('edit.php?post_type=' . $post_type, __('Calendar', 'editorial-calendar'), __('Calendar', 'editorial-calendar'), 'edit_posts', 'cal_' . $post_type, 'edcal_list_admin');
add_action("admin_print_scripts-{$page}", 'edcal_scripts');
}
}
}
}
示例2: admin_menu
public function admin_menu()
{
$this->user_created_pages = SerializeStringToArray(get_option($this->prefix('user_created_pages')));
if ($this->user_created_pages && count($this->user_created_pages) >= 1) {
foreach ($this->user_created_pages as $page) {
if (isset($page['page_slug']) && isset($page['page_title']) && isset($page['parent_menu'])) {
if ($page['parent_menu'] == 'new_menu') {
add_menu_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'dashboard') {
add_dashboard_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'posts') {
add_posts_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'media') {
add_media_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'pages') {
add_pages_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'comments') {
add_comments_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'theme') {
add_theme_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'plugins') {
add_plugins_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'users') {
add_users_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'management') {
add_management_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif ($page['parent_menu'] == 'options') {
add_options_page($page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
} elseif (array_key_exists($page['parent_menu'], $user_pages)) {
add_submenu_page($page['parent_menu'], $page['page_title'], $page['page_title'], 'manage_options', $page['page_slug'], array($this, 'user_created_menu_pages'));
}
}
}
}
}
示例3: menu
function menu(){
add_posts_page('Newsletter Creator', 'Newsletter Creator', 'edit_posts', 'newsletter-creator', 'overview');
add_posts_page('', '', 'edit_posts', 'newsletter-create', 'newsletter_create');
add_posts_page('', '', 'edit_posts', 'newsletter-htmlcode', 'newsletter_html');
add_posts_page('', '', 'edit_posts', 'newsletter-edit', 'newsletter_edit');
add_posts_page('', '', 'edit_posts', 'newsletter-delete', 'newsletter_delete');
}
示例4: post_footer_menus
function post_footer_menus()
{
add_posts_page('Add New Post Footer', 'Add New Post Footer', 'delete_others_posts', dirname(__FILE__) . '/add-wp-post-footer.php');
add_posts_page('Edit Post Footer', 'Edit Post Footer', 'delete_others_posts', dirname(__FILE__) . '/edit-wp-post-footer.php');
add_posts_page('Delete Post Footer', 'Delete Post Footer', 'delete_others_posts', dirname(__FILE__) . '/delete-wp-post-footer.php');
add_posts_page('Post Footer Library', 'Post Footer Library', 'delete_others_posts', dirname(__FILE__) . '/wp-post-footer-library.php');
}
示例5: addMenuItem
public function addMenuItem()
{
switch ($this->pageType) {
case "top":
if ($this->actionHookIsValid($this->menuSlug, '')) {
add_menu_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
case "custom":
if ($this->actionHookIsValid($this->menuSlug, "edit.php?post_type={$this->targetPostType}")) {
add_submenu_page("edit.php?post_type={$this->targetPostType}", $this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
//add_posts_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array( &$this, 'render' ));
}
break;
case "dashboard":
if ($this->actionHookIsValid($this->menuSlug, 'index.php')) {
add_dashboard_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
case "posts":
if ($this->actionHookIsValid($this->menuSlug, 'edit.php')) {
add_posts_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
case "pages":
if ($this->actionHookIsValid($this->menuSlug, 'edit.php?post_type=page')) {
add_pages_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
case "settings":
if ($this->actionHookIsValid($this->menuSlug, 'options-general.php')) {
add_options_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
case "users":
if ($this->actionHookIsValid($this->menuSlug, 'user.php') || $this->actionHookIsValid($this->menuSlug, 'profile.php')) {
add_users_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
case "plugins":
if ($this->actionHookIsValid($this->menuSlug, 'plugins.php')) {
add_plugins_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
case "theme":
if ($this->actionHookIsValid($this->menuSlug, 'themes.php')) {
add_theme_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
default:
// Defaults to Tools Menu
if ($this->actionHookIsValid($this->menuSlug, 'tools.php')) {
add_management_page($this->pageTitle, $this->menuTitle, $this->userCapabilities, $this->menuSlug, array(&$this, 'render'));
}
break;
}
return $this;
}
示例6: oaf_create_submenu
function oaf_create_submenu()
{
add_dashboard_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_posts_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_media_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_pages_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_comments_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_theme_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_users_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_management_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
add_options_page('OAF Settings', 'OAF Settings', 'manage_options', 'oaf_create_submenu_plugin', 'oaf_create_submenu_function');
}
示例7: my_admin_menu
function my_admin_menu()
{
//create a main admin panel
//create a sub admin panel link above
add_menu_page('Bandi Summary', 'Bandi Summary', 'administrator', 9, array(&$this, 'overview'));
//These functions adds sub menu for different kinds of admin panel on back end
add_options_page('Mahesh Options', 'Mahesh Plugin', 'administrator', basename(__FILE__), array(&$this, 'my_plugin_options'));
add_posts_page('Mahesh posts', 'Mahesh Plugin', 'administrator', basename(__FILE__), array(&$this, 'my_plugin_posts'));
add_media_page('Mahesh media', 'Mahesh Plugin', 'administrator', basename(__FILE__), array(&$this, 'my_plugin_media'));
add_pages_page('Mahesh pages', 'Mahesh Plugin', 'administrator', basename(__FILE__), array(&$this, 'my_plugin_pages'));
add_users_page('Mahesh users', 'Mahesh Plugin', 'administrator', basename(__FILE__), array(&$this, 'my_plugin_users'));
add_management_page('Bandi', 'Mahesh Plugin', 'administrator', basename(__FILE__), array(&$this, 'my_plugin_tools'));
add_theme_page('Bandi', 'Mahesh Plugin', 'administrator', basename(__FILE__), array(&$this, 'my_plugin_themes'));
}
示例8: ead_menu
function ead_menu()
{
if ($_GET['page'] == 'ead') {
if ('save' == $_REQUEST['action']) {
if ($_FILES) {
$f = ead_upload_file($_FILES);
if ($f['error']) {
update_option('ead-error', $f['error']);
header("Location: edit.php?page=ead.php&error=true");
die;
} else {
update_option('ead-title', $_REQUEST['ead-title']);
update_option('ead-file', $f['file']);
header("Location: edit.php?page=ead.php&saved=true");
die;
}
}
}
}
add_posts_page('Import EAD', 'Import EAD', 'manage_options', 'ead', 'ead_options');
}
示例9: admin_menu_link
function admin_menu_link()
{
//一般权限设置
add_options_page('弹幕播放器配置', 'MukioPlayer', 'edit_plugins', basename(__FILE__), array($this, 'admin_options_page'));
//edit_plugins(管理员)权限
add_posts_page('弹幕管理', '弹幕管理', 'edit_posts', 'mukioplayer-for-wordpress/cmt.php');
//edit_posts权限
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'filter_plugin_actions'), 10, 2);
add_filter("post_row_actions", array(&$this, "edit_cmt_link"), 10, 2);
}
示例10: add_page
/**
* Adds the current page to the admin.
*/
function add_page($type = "options")
{
if ("presentation" == $type) {
add_theme_page($this->page_title, $this->menu_title, 8, $this->get_short_name(), array($this, 'page'));
} else {
if ("management" == $type) {
add_management_page($this->page_title, $this->menu_title, 8, $this->get_short_name(), array($this, 'page'));
} else {
if ("pages" == $type) {
add_pages_page($this->page_title, $this->menu_title, 8, $this->get_short_name(), array($this, 'page'));
} else {
if ("posts" == $type) {
add_posts_page($this->page_title, $this->menu_title, 8, $this->get_short_name(), array($this, 'page'));
} else {
add_options_page($this->page_title, $this->menu_title, 8, $this->get_short_name(), array($this, 'page'));
}
}
}
}
add_action("admin_head", array($this, 'head'));
}
示例11: enable_post_sort
/**
* Add submenu
*
* @author Ryan Hellyer <ryan@metronet.no>
* @since Reorder 1.0
* @access public
*/
public function enable_post_sort()
{
$post_type = $this->post_type;
if ('post' != $post_type) {
$hook = add_submenu_page('edit.php?post_type=' . $post_type, $this->heading, $this->menu_label, 'edit_posts', 'reorder-' . $post_type, array($this, 'sort_posts'));
} else {
$hook = add_posts_page($this->heading, $this->menu_label, 'edit_posts', 'reorder-posts', array($this, 'sort_posts'));
}
add_action('admin_print_styles-' . $hook, array($this, 'print_styles'));
add_action('admin_print_scripts-' . $hook, array($this, 'print_scripts'));
}
示例12: admin_menu
function admin_menu()
{
add_posts_page('Get NPR Stories', 'Get NPR Stories', 'edit_posts', 'get-npr-stories', array(&$this, 'get_npr_stories'));
}
示例13: lgom_plugin_menu
function lgom_plugin_menu()
{
$page = add_posts_page('LinkGrab', 'Link Grab-o-Matic', 'read', 'lgom-menu-item', 'my_plugin_function');
add_action('admin_print_styles-' . $page, 'lgom_plugin_admin_styles');
}
示例14: add_plugin_menu
public static function add_plugin_menu()
{
add_posts_page('Bulk Post Creator Plus', 'Create Bulk Posts', 'edit_posts', 'bulk-post-creator-plus/np-bulk-post-creator-plus.php', array('NPBulkPostCreatorPlus', 'bulk_post_add_form'));
}
示例15: mailusers_add_pages
function mailusers_add_pages()
{
global $mailusers_user_custom_meta_filters;
global $mailusers_group_custom_meta_filters;
mailusers_init_i18n();
add_posts_page(__('Notify Users', MAILUSERS_I18N_DOMAIN), __('Notify Users', MAILUSERS_I18N_DOMAIN), MAILUSERS_NOTIFY_USERS_CAP, 'mailusers-send-notify-mail-post', 'mailusers_send_notify_mail');
add_pages_page(__('Notify Users', MAILUSERS_I18N_DOMAIN), __('Notify Users', MAILUSERS_I18N_DOMAIN), MAILUSERS_NOTIFY_USERS_CAP, 'mailusers-send-notify-mail-page', 'mailusers_send_notify_mail');
add_options_page(__('Email Users', MAILUSERS_I18N_DOMAIN), __('Email Users', MAILUSERS_I18N_DOMAIN), 'manage_options', 'mailusers-options-page', 'mailusers_options_page');
add_menu_page(__('Email Users', MAILUSERS_I18N_DOMAIN), __('Email Users', MAILUSERS_I18N_DOMAIN), MAILUSERS_EMAIL_SINGLE_USER_CAP, plugin_basename(__FILE__), 'mailusers_overview_page', plugins_url('images/email.png', __FILE__));
// Send to User(s) Menu
add_submenu_page(plugin_basename(__FILE__), __('Send to User(s)', MAILUSERS_I18N_DOMAIN), __('Send to User(s)', MAILUSERS_I18N_DOMAIN), MAILUSERS_EMAIL_SINGLE_USER_CAP, 'mailusers-send-to-user-page', 'mailusers_send_to_user_page');
/**
* Do we need to deal with a user custom meta filter?
*
*/
// Load any custom meta filters
do_action('mailusers_user_custom_meta_filter');
foreach ($mailusers_user_custom_meta_filters as $mf) {
$slug = strtolower($mf['label']);
$slug = preg_replace("/[^a-z0-9\\s-]/", "", $slug);
$slug = trim(preg_replace("/[\\s-]+/", " ", $slug));
$slug = trim(substr($slug, 0));
$slug1 = preg_replace("/\\s/", "-", $slug);
$slug2 = preg_replace("/\\s/", "_", $slug);
// Need to create the function to call the custom filter email script
$fn = create_function('', 'global $mailusers_mf, $mailusers_mv, $mailusers_mc; $mailusers_mf = \'' . $mf['meta_filter'] . '\' ; $mailusers_mv = \'' . $mf['meta_value'] . '\' ; $mailusers_mc = \'' . $mf['meta_compare'] . '\' ; require(\'email_users_send_custom_filter_mail.php\') ;');
add_submenu_page(plugin_basename(__FILE__), sprintf(__('Send to %s'), $mf['label'], MAILUSERS_I18N_DOMAIN), sprintf(__('Send to %s'), $mf['label'], MAILUSERS_I18N_DOMAIN), MAILUSERS_EMAIL_USER_GROUPS_CAP, 'mailusers-send-to-custom-filter-page-' . $slug1, $fn);
//'mailusers_send_to_custom_filter_page_' . $slug2) ;
}
// Send to Group(s) Menu
add_submenu_page(plugin_basename(__FILE__), __('Send to Group(s)', MAILUSERS_I18N_DOMAIN), __('Send to Group(s)', MAILUSERS_I18N_DOMAIN), MAILUSERS_EMAIL_USER_GROUPS_CAP, 'mailusers-send-to-group-page', 'mailusers_send_to_group_page');
/**
* Do we need to deal with a user custom meta filter?
*
*/
// Load any custom meta key filters
do_action('mailusers_group_custom_meta_key_filter');
// Load any custom meta filters
do_action('mailusers_group_custom_meta_filter');
/**
if (!empty($mailusers_group_custom_meta_filters))
{
// Send to Group(s) Menu
add_submenu_page(plugin_basename(__FILE__),
__('Send to Meta Group(s)', MAILUSERS_I18N_DOMAIN),
__('Send to Meta Group(s)', MAILUSERS_I18N_DOMAIN),
MAILUSERS_EMAIL_USER_GROUPS_CAP,
'mailusers-send-to-group-custom-meta-page',
'mailusers_send_to_group_custom_meta_page') ;
}
**/
// User Settings Menu
add_submenu_page(plugin_basename(__FILE__), __('User Settings', MAILUSERS_I18N_DOMAIN), __('User Settings', MAILUSERS_I18N_DOMAIN), 'edit_users', 'mailusers-user-settings', 'mailusers_user_settings_page');
}