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 want to display my custom menu in custom post listing page under the title of custom post type.

For example there are post type and one small icon on custom post type listing page as well as add/edit custom post type page.

Under that icon I want to add my custom menu from my custom plugin.

snapshot

Can I add my menu at that place?

One more thing is that can I add "Cancel" link to the add/edit page for go to listing page?

share|improve this question
add comment

1 Answer

To insert links at that position, you need the filter views_edit-POST_TYPE, replacing POST_TYPE by the slug of your CPT.

Example:

add_filter( 'views_edit-portfolio', 'custom_list_link_wpse_79975' );

function custom_list_link_wpse_79975( $views ) 
{
    $views['dashboard'] = '<a href="' . admin_url('index.php') . '">Dashboard</a>';
    // $views['another-view'] = '<a href="#">Contact</a>';
    return $views;
}

Results in:
views edit cpt


The second question should have been a separate Q, but while we at it...

You could create your own meta box, but there's a couple of useful hooks:

// Another possible action hook is: post_submitbox_start
add_action( 'post_submitbox_misc_actions', 'custom_publish_link_wpse_79975' );

function custom_publish_link_wpse_79975() 
{
    // check for post type
    global $current_screen;
    if( 'portfolio' != $current_screen->post_type )
        return;

    echo '<div class="misc-pub-section my-link">
        <a href="' . admin_url('edit.php?post_type=portfolio') . '">Cancel</a>
        </div>';
}

Which results in:

cancel in publish meta box

share|improve this answer
    
Thanks brasofilo for quick reply. it is work for me. and saved my time. –  Gandhi Pranav Jan 10 '13 at 6:43
    
This may be helpful too. –  brasofilo Jan 10 '13 at 6:49
add comment

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.