Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

odd even

By: a guest on Feb 3rd, 2013  |  syntax: None  |  size: 0.46 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // Assign even and odd classes to nav bar menu items
  2.  
  3. add_action('wp_enqueue_scripts', 'add_my_code');
  4.  
  5. function add_my_code() {
  6.     add_action( 'print_footer_scripts', 'my_footer_script' );
  7. }
  8.  
  9. function my_footer_script() { ?>
  10.     <script type="text/javascript">
  11.         jQuery(document).ready(function($) {
  12.                 $("#menu-standaard > li:nth-child(odd)").addClass("odd");
  13.                 $("#menu-standaard > li:nth-child(even)").addClass("even");
  14.         });
  15.     </script>
  16. <?php }