Пример #1
1
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');
            }
        }
    }
}
 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
0
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
0
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');
}
 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;
 }
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
0
 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
0
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
0
 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
0
 /**
  * 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
0
 /**
  * Add submenu
  *
  * @author Ryan Hellyer <*****@*****.**>
  * @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
0
 function admin_menu()
 {
     add_posts_page('Get NPR Stories', 'Get NPR Stories', 'edit_posts', 'get-npr-stories', array(&$this, 'get_npr_stories'));
 }
Пример #13
0
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
0
 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
0
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');
}
Пример #16
0
 function woo_tumblog_menu()
 {
     global $tumblog_plugin_hook;
     //creat options page
     $tumblog_plugin_hook = add_posts_page('Tumblog Options', 'Tumblog Options', 'manage_options', 'tumblog', array(&$this, 'woo_tumblog_options'));
 }
Пример #17
0
 /**
  * Load the menu in the backend
  */
 public function load_menu()
 {
     $postController = new WPBAPOSTPostList();
     add_posts_page(WPBAPOST_NAME, WPBAPOST_NAME, 'read', WPBAPOST_SHORT_NAME, array($postController, 'index'));
 }
Пример #18
0
	/**
	 * Add WP admin menu for Tags
	 *
	 */
	function adminMenu() {
		add_posts_page( __('Simple Terms: Manage Terms', 'simpletags'), __('Manage Terms', 'simpletags'), 'simple_tags', 'st_manage', array(&$this, 'pageManageTags'));
		add_posts_page( __('Simple Terms: Mass Edit Terms', 'simpletags'), __('Mass Edit Terms', 'simpletags'), 'simple_tags', 'st_mass_tags', array(&$this, 'pageMassEditTags'));
		add_posts_page( __('Simple Terms: Auto Terms', 'simpletags'), __('Auto Terms', 'simpletags'), 'simple_tags', 'st_auto', array(&$this, 'pageAutoTags'));
		add_options_page( __('Simple Tags: Options', 'simpletags'), __('Simple Tags', 'simpletags'), 'admin_simple_tags', 'st_options', array(&$this, 'pageOptions'));
	}
Пример #19
0
/**
 * Adds a sub-menu item in Posts menu
 */
function guruq_questions_menu()
{
    add_posts_page(GURUQ_CAT, GURUQ_CAT, 'administrator', GURUQ_SLUG, 'guruq_edit_page');
}
Пример #20
0
function create_fuzzy_featured_posts_menu()
{
    add_posts_page('Featured Posts', 'Featured Posts', 'manage_options', 'fuzzy_featured_posts', 'create_fuzzy_featured_posts_page');
}
 /**
  * Loads the admin menu with user-defined flags.
  */
 function load_admin_menu()
 {
     switch ($this->menu_type) {
         case 'page':
             $hook = add_pages_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'link':
             $hook = add_links_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'comment':
             $hook = add_comments_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'management':
             $hook = add_management_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'option':
             $hook = add_options_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'theme':
             $hook = add_theme_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'plugin':
             $hook = add_plugins_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'user':
             $hook = add_users_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'dashboard':
             $hook = add_dashboard_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'post':
             $hook = add_posts_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         case 'media':
             $hook = add_media_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
             break;
         default:
             $hook = add_menu_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'), $this->icon, isset($this->menu_pos) ? $this->menu_pos : null);
             break;
     }
     $this->hook = $hook;
 }
Пример #22
0
function gdocs_admin_add_page()
{
    add_posts_page('Docs to Wordpress', 'Docs to Wordpress', 'edit_posts', 'gdocs-admin', 'gdocs_admin');
}
 /**
  * Add submenu
  *
  * @author Ryan Hellyer <*****@*****.**>
  * @since Reorder 1.0
  * @access public
  */
 public function enable_post_sort()
 {
     $post_type = $this->post_type;
     if ('post' != $post_type) {
         $menu_location = apply_filters('metronet_reorder_menu_location_' . $post_type, 'edit.php?post_type=' . $post_type, $post_type);
         $hook = add_submenu_page($menu_location, $this->heading, apply_filters('metronet_reorder_menu_label_' . $post_type, $this->menu_label, $post_type), 'edit_pages', 'reorder-' . $post_type, array($this, 'sort_posts'));
         $this->reorder_page = add_query_arg(array('page' => 'reorder-' . $post_type), admin_url($menu_location));
     } else {
         $hook = add_posts_page($this->heading, apply_filters('metronet_reorder_menu_label_' . $post_type, $this->menu_label), 'edit_pages', 'reorder-posts', array($this, 'sort_posts'));
         $this->reorder_page = add_query_arg(array('page' => 'reorder-posts'), admin_url('edit.php'));
     }
     do_action('metronet_reorder_posts_add_menu_' . $post_type, $hook);
     //Allow other plugin authors to add scripts/styles to our menu items
     do_action('metronet_reorder_menu_url_' . $post_type, $this->reorder_page);
     add_action('admin_print_styles-' . $hook, array($this, 'print_styles'));
     add_action('admin_print_scripts-' . $hook, array($this, 'print_scripts'));
 }
function featured_posts_list_admin_menu()
{
    // add_options_page('FPK Featured Posts', 'FPK Featured Posts', 'manage_options', 'fpk-featured-posts-list', 'featured_posts_list_admin_page');
    add_posts_page('FPK Featured Posts', 'Featured Posts', 'edit_posts', 'fpk-featured-posts-list', 'featured_posts_list_admin_page');
}
Пример #25
0
 function mycategoryorder_menu()
 {
     add_posts_page(__('My Category Order', 'mycategoryorder'), __('My Category Order', 'mycategoryorder'), 'manage_categories', 'mycategoryorder', 'mycategoryorder');
 }
Пример #26
0
 /**
  * Create a WP Settings Page in the Posts section
  * @todo Allow both menu page and options page?
  * @param string $page_title
  * @param string $page_subtitle
  * @param string $menu_title
  * @param string $capability
  * @param string $menu_slug
  * @param string|array $function
  * @param string $icon_url Optional
  * @param int|null $position Optional
  * @return WPSettingsPage
  */
 public function __construct($page_title, $page_subtitle, $menu_title, $capability, $menu_slug, $function)
 {
     // Call parent constructor to setup everything
     parent::__construct($page_title, $page_subtitle, $menu_title, $capability, $menu_slug, $function, null, null);
     // Add posts page
     add_posts_page($page_title, $menu_title, $capability, $menu_slug, $function);
     return $this;
 }
function ung_menu(){
    add_posts_page('Newsletters', 'Newsletters', 'edit_posts', 'ung_list', 'ung_list');
    add_posts_page('Create a new newsletter', 'Create newsletter', 'edit_posts', 'ung-create-newsletter', 'ung_new');
    add_posts_page('', '', 'edit_posts', 'ung_edit', 'ung_edit');
}
Пример #28
0
 /**
  * Displays the menu entry on the WordPress Dashboard
  *
  * @return bool Returns `true` if successful, `false` otherwise.
  * @throws \Exception if the no title or callback function was specified
  */
 public function display()
 {
     if (empty($this->title) || empty($this->_properties['callback'])) {
         throw new \Exception('No title or callback function specified for menu entry');
     }
     $title = $this->title;
     $page_title = $this->page_title;
     $icon = $this->icon;
     $capability = $this->capability;
     $parent = $this->_properties['parent_slug'];
     $slug = $this->_properties['slug'];
     if (empty($slug)) {
         $_cb = $this->_properties['callback'];
         $slug = Helpers::makeSlug(is_array($_cb) ? $_cb[1] : (string) $_cb);
         // Since 1.0.5, slug is based on callback function name
         unset($_cb);
     }
     if (empty($page_title)) {
         $page_title = $title;
     }
     // Sanitize and add count to the title here (prior operations use a "clean" title)
     if ($this->count !== false) {
         $title = htmlspecialchars($title) . ' <span class="awaiting-mod"><span class="pending-count">' . $this->count . '</span></span>';
     } else {
         $title = htmlspecialchars($title);
     }
     // We call our own callback first
     $callback = array($this, 'onMenuCallback');
     switch ($this->_properties['type']) {
         case self::MT_CUSTOM:
             if (empty($capability)) {
                 $capability = 'read';
             }
             $this->hook = add_menu_page($page_title, $title, $capability, $slug, $callback, $icon);
             break;
         case self::MT_SUBMENU:
             if (empty($capability)) {
                 $capability = 'read';
             }
             if (!$this->_properties['use_subheaders']) {
                 $this->hook = add_submenu_page($parent, $page_title, $title, $capability, $slug, $callback);
             } else {
                 $this->hook = '';
             }
             break;
         case self::MT_COMMENTS:
             if (empty($capability)) {
                 $capability = 'moderate_comments';
             }
             $this->hook = add_comments_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_DASHBOARD:
             if (empty($capability)) {
                 $capability = 'read';
             }
             $this->hook = add_dashboard_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_LINKS:
             if (empty($capability)) {
                 $capability = 'manage_links';
             }
             $this->hook = add_links_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_TOOLS:
             if (empty($capability)) {
                 $capability = 'import';
             }
             $this->hook = add_management_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_MEDIA:
             if (empty($capability)) {
                 $capability = 'upload_files';
             }
             $this->hook = add_media_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_SETTINGS:
             if (empty($capability)) {
                 $capability = 'manage_options';
             }
             $this->hook = add_options_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_PAGES:
             if (empty($capability)) {
                 $capability = 'edit_pages';
             }
             $this->hook = add_pages_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_PLUGINS:
             if (empty($capability)) {
                 $capability = 'update_plugins';
             }
             $this->hook = add_plugins_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_POSTS:
             if (empty($capability)) {
                 $capability = 'edit_posts';
             }
             $this->hook = add_posts_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_THEMES:
             if (empty($capability)) {
                 $capability = 'edit_theme_options';
             }
             $this->hook = add_theme_page($page_title, $title, $capability, $slug, $callback);
             break;
         case self::MT_USERS:
             if (empty($capability)) {
                 $capability = 'edit_users';
             }
             $this->hook = add_users_page($page_title, $title, $capability, $slug, $callback);
             break;
         default:
             $this->hook = false;
             break;
     }
     $this->displayed = $this->hook !== false;
     if ($this->displayed) {
         // Write back any changes for future reference
         $this->_properties['slug'] = $slug;
         $this->capability = $capability;
         $this->page_title = $page_title;
     }
     return $this->displayed;
 }
 /**
  * Add submenu items
  */
 function add_menu_items()
 {
     add_media_page(__('Manage UGC', 'frontend-uploader'), __('Manage UGC', 'frontend-uploader'), $this->manage_permissions, 'manage_frontend_uploader', array($this, 'admin_list'));
     foreach ((array) $this->settings['enabled_post_types'] as $cpt) {
         if ($cpt == 'post') {
             add_posts_page(__('Manage UGC Posts', 'frontend-uploader'), __('Manage UGC', 'frontend-uploader'), $this->manage_permissions, 'manage_frontend_uploader_posts', array($this, 'admin_posts_list'));
             continue;
         }
         add_submenu_page("edit.php?post_type={$cpt}", __('Manage UGC Posts', 'frontend-uploader'), __('Manage UGC', 'frontend-uploader'), $this->manage_permissions, "manage_frontend_uploader_{$cpt}s", array($this, 'admin_posts_list'));
     }
 }
 /**
  * Register reorder submenu.
  *
  * @since 1.0
  * @access public
  */
 public function register_screens()
 {
     /**
      * Fires before screens are registered.
      *
      * @since 1.0
      */
     do_action('ptq_reorder_before_register_screens');
     $post_type = $this->post_type;
     if ('post' != $post_type) {
         $hook = add_submenu_page('edit.php?post_type=' . $post_type, $this->heading, $this->menu_label, $this->capability, 'ptq-reorder-' . $post_type, array($this, 'display_screen'));
     } else {
         $hook = add_posts_page($this->heading, $this->menu_label, $this->capability, 'ptq-reorder-' . $post_type, array($this, 'display_screen'));
     }
     add_action('admin_print_styles-' . $hook, array($this, 'enqueue_styles'));
     add_action('admin_print_scripts-' . $hook, array($this, 'enqueue_scripts'));
     /**
      * Fires after screens are registered.
      *
      * @since 1.0
      */
     do_action('ptq_reorder_after_register_screens');
 }