Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. add_action( 'admin_bar_menu', 'remove_nodes_mysites', 999 );
  2. function remove_nodes_mysites( $bar )
  3. {
  4. $sites = get_blogs_of_user( get_current_user_id() );
  5. foreach ( $sites as $site )
  6. {
  7. // Open Visit Site in new window/tab
  8. $visit_site_node = $bar->get_node( "blog-{$site->userblog_id}-v" ); // Visit Site
  9. $visit_site_node->meta['target'] = '_blank';
  10. $bar->add_node($visit_site_node);
  11. }
  12. }
  13.  
  14. add_filter( 'myblogs_blog_actions', 'my_sites_visit_site_target_blank', 10, 2 );
  15.  
  16. function my_sites_visit_site_target_blank( $actions, $user_blog ) {
  17. $to_replace = ">" . __( 'Visit' ) . '</a>';
  18. $to_replace_with = " target='_blank' >" . __( 'Visit' ) . '</a>';
  19. return str_replace( $to_replace, $to_replace_with, $actions );
  20. }
Add Comment
Please, Sign In to add comment