logo

$12
WP-Admin Screen Meta Links

WP community member w-shadow has a great tutorial about adding new buttons alongside “screen options” and “help”. The tutorial even provides code samples in a ready to go downloadable script.

The winning answer will help with two things:
1) Modify the script so that it works on any theme page, including a theme options page.

2) Provide a working example of both the orange Feedback and green Upgrade tabs. These tabs should be displayed side-by-side and CSS for the green tab is included in the script.

You can post your code here or on the code snippet service of your choice. :)

attachment image View Attachment

Matt Taylor | 08/26/10 at 8:00am | Edit


(1) Possible Answers Submitted...

  • avatar
    Last edited:
    08/26/10
    12:12pm
    Michael Fields says:

    Just add the following lines to your theme's functions.php file: http://wordpress.pastebin.com/fQa0mpsF

    Previous versions of this answer: 08/26/10 at 10:24am

    • 08/26/10 10:57am

      Matt Taylor says:

      Michael, thank you for the script. That is exactly what I am looking for except that the tabs are showing on any wp-admin page. How do I show them only on a theme related page?

    • 08/26/10 11:05am

      Michael Fields says:

      I thought that you wanted to use them on all the admin pages? Now that I re-read your posts. It looks like I was wrong.... sorry about that. Could you please post the code that you use to create the admin page - or better yet tell me what string is returned by add_menu_page()?

      Basically, you will need to store the output of add_menu_page() in a variable and then you should be able to use this variable in the following function:

      add_screen_meta_link(
      'my-theme-feedback-link', //Link ID. Should be unique.
      'Feedback', //Link text.
      'http://example.com/', //URL
      $myCustomAdminPage //Where to show the link.
      );
      add_screen_meta_link(
      'my-theme-upgrade-link', //Link ID. Should be unique.
      'Upgrade', //Link text.
      'http://example.com/', //URL
      $myCustomAdminPage //Where to show the link.
      );


      Now that I understand what you need to do, I don't think that it is really necessary to alter the script at all.

    • 08/26/10 12:12pm

      Matt Taylor says:

      Thanks Michael!

This question has expired.





Current status of this question: Completed