Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I hope there is an easy answer for this, as it doesn't seem like it should be difficult and could make my backend much easier for other's to use.

I'm trying to add links to custom post types - that is, a shortcut in the sidebar, not a typical wordpress link that you would put in the link category.

Let's say my sidebar looks like:

Dashboard
----------
Posts
...
Stores (custom post-type)
- All Stores
- Add Store
- My custom link

The last line would be the custom link. Hopefully it is possible to make this link appear as a child to a custom post type, but if not at least having a static link would be a good start.

The closest I could find on Google was this page about adding separators to the admin panel, which is useful for indicating my custom post types. Unfortunately the code for this is very alien to me (and the comments are only present on the obvious code, which is very frustrating).

I assume that the code used for the separator is at least close to what I need, though. At the very least, where should I even look for an answer?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This should do it.

function register_additional_page(){
    add_submenu_page('edit.php?post_type=tree', 'Bulk Process', 'Bulk Process', 'activate_plugins', 'tree_bulk_process', 'render_bulk_tree_process');
}
add_action('admin_menu', 'register_additional_page');

And the function that renders the page.

function render_voucher_list_page(){
    ?>
        <h2>Hello World</h2>
    <?php
}

Change post_type=tree to your Custom Post Type, Bulk Process to the menu title, activate_plugins to your desired user capability, tree_bulk_process to your page 'slug' and render_bulk_tree_process to your custom function that renders the page.

Hope this help

share|improve this answer
    
Oh man, how could I not have found this? Works like a charm. Is there a way to instead of making this render a custom page, make it link to an existing URL (internal or external)? Especially for if I have a menu that says "Manage Links" but I want to use built-in link category, I'd want to link the menu to /wp-admin/link-manager.php?cat_id=23, which would show links within a specified category. –  RadGH Sep 3 '12 at 2:16
    
Haven't tried to make it an internal link to link manager. I'll check it later on. –  ifdion Sep 3 '12 at 2:18
    
I'll just go with a javascript redirect for now, the plus side being the page can display a "You are leaving Wordpress..." or something similar. I didn't see anything in the codex about it, but I'm satisfied with JS redirect. –  RadGH Sep 3 '12 at 2:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.