Guest User

Untitled

a guest
Jan 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php
  2. // Add filter that inserts our new tab
  3. function nsm_menu($tabs) {
  4. $newtab = array('shared_media' => __('Network Shared Media', 'networksharedmedia'));
  5. return array_merge($tabs, $newtab);
  6. }
  7. add_filter('media_upload_tabs', 'nsm_menu');
  8.  
  9. // Load media_nsm_process() into the existing iframe
  10. function nsm_menu_handle() {
  11. return wp_iframe('media_nsm_process');
  12. }
  13. add_action('media_upload_shared_media', 'nsm_menu_handle');
  14.  
  15. /*
  16. * media_nsm_process() contains the code for what you want to display. This function MUST start with the word 'media' in order
  17. * for the proper CSS to load.
  18. *
  19. * First, we switch to the blog containing all of the media. This is called up by the blog # found in the database.
  20. *
  21. * Then we call media_upload_library() which contains all of the code needed to show the library, select media sizes, and
  22. * insert into the post.
  23. */
  24.  
  25. function media_nsm_process() {
  26. switch_to_blog(3);
  27. media_upload_library();
  28. }
  29. ?>
Add Comment
Please, Sign In to add comment