Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. //menu post counter
  2.  
  3. function prefix_nav_description( $item_output, $item, $depth, $args ) {
  4. $original_blog_id = get_current_blog_id();
  5. switch_to_blog(2);
  6. $count_posts = wp_count_posts();
  7. $site1 = $count_posts->publish;
  8. switch_to_blog(3);
  9. $count_posts = wp_count_posts();
  10. $site2 = $count_posts->publish;
  11. switch_to_blog(15);
  12. $count_posts = wp_count_posts();
  13. $site3 = $count_posts->publish;
  14. switch_to_blog(18);
  15. $count_posts = wp_count_posts();
  16. $site4 = $count_posts->publish;
  17. switch_to_blog(20);
  18. $count_posts = wp_count_posts();
  19. $site5 = $count_posts->publish;
  20. switch_to_blog(22);
  21. $count_posts = wp_count_posts();
  22. $site6 = $count_posts->publish;
  23. switch_to_blog(21);
  24. $count_posts = wp_count_posts();
  25. $site7 = $count_posts->publish;
  26. switch_to_blog(6);
  27. $count_posts = wp_count_posts();
  28. $site8 = $count_posts->publish;
  29. switch_to_blog(16);
  30. $count_posts = wp_count_posts();
  31. $site9 = $count_posts->publish;
  32. switch_to_blog(17);
  33. $count_posts = wp_count_posts();
  34. $site10 = $count_posts->publish;
  35. switch_to_blog(19);
  36. $count_posts = wp_count_posts();
  37. $site11 = $count_posts->publish;
  38. switch_to_blog( $original_blog_id );
  39.  
  40. $item_output = str_replace( "Volvo", "Volvo ($site1)", $item_output );
  41. $item_output = str_replace( "Mazda", "Mazda ($site2)", $item_output );
  42. $item_output = str_replace( "BMW", "BMW ($site3)", $item_output );
  43. $item_output = str_replace( "Mercedes", "Mercedes ($site4)", $item_output );
  44. $item_output = str_replace( "Porsche", "Porsche ($site5)", $item_output );
  45. $item_output = str_replace( "Mitsubishi", "Mitsubishi ($site6)", $item_output );
  46. $item_output = str_replace( "Hyundai", "Hyundai ($site7)", $item_output );
  47. $item_output = str_replace( "Fiat", "Fiat ($site8)", $item_output );
  48. $item_output = str_replace( "Ferrari", "Ferrari ($site9)", $item_output );
  49. $item_output = str_replace( "Citroen", "Citroen ($site10)", $item_output );
  50. $item_output = str_replace( "Renault", "Renault ($site11)", $item_output );
  51.  
  52.  
  53. return $item_output;
  54. }
  55. add_filter( 'walker_nav_menu_start_el', 'prefix_nav_description', 10, 4 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement