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 would like another "Add post" button in the admin except I am going to call it "Add voucher". It will run specific plugins that add post will not. However that is irrelivant, all I need to know it how to add another add post button with the same features.

share|improve this question

1 Answer 1

Unfortunately this isn't possible (without a slight hack)- since there are now hooks provided (see for example the edit.php page)

A quick an easy hack is to use javascript to add the link after the usual 'Add New' link. Here I've used the admin_print_footer_scripts hook (on 'post', or 'edit-post' screens) to print the javascript. Note you alter this to work for other post types.

add_action('admin_print_footer_scripts','wpse57033_add_new_voucher_link');
function wpse57033_add_new_voucher_link(){
    $screen = get_current_screen();
    if( $screen->id == 'edit-post' || $screen->id == 'post' ){
        ?>
            <script>
            jQuery('.wrap h2 .add-new-h2').after('<a href="" class="add-new-h2">Add New Voucher</a>');
            </script>
        <?php
    }
}
share|improve this answer
    
@RuturaajPatki asked why some people check $variable == 'value' and others 'value'== $variable. I've been lazy in this answer, but the latter is best practise (see this for an explanation). Otherwise they are the same. –  Stephen Harris Jul 1 '12 at 14:29

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.