Advertisement
richardmhowell

Functions.php Canvas Child

Mar 20th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.30 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. /*-----------------------------------------------------------------------------------*/
  5. /* You can add custom functions below */
  6. /*-----------------------------------------------------------------------------------*/
  7. // Remove main nav from the woo_header_after hook
  8.     remove_action('woo_header_after','woo_nav');
  9. // Add main nav to the woo_header_inside hook
  10.     add_action('woo_header_inside','woo_nav');
  11. add_filter( 'walker_nav_menu_start_el', 'woo_custom_nav_menu_start_el', 10, 4 );
  12.  
  13. function woo_custom_nav_menu_start_el( $item_output, $item, $depth, $args ) {
  14.  
  15.     if ( $args->theme_location == 'primary-menu' ) {
  16.         $description  = '';
  17.         if ( ! empty( $item->description ) && ( $depth == 0 ) ) {
  18.             $description = '<span class="description">' . esc_attr( $item->description ) . '</span>';
  19.         }
  20.  
  21.         // Get the description to sit inside the anchor tag.
  22.         $item_output = str_replace( '</a>', $description . '</a>', $item_output );
  23.     }
  24.  
  25.     return $item_output;
  26. } // End woo_custom_nav_menu_start_el()
  27.  
  28. /*-----------------------------------------------------------------------------------*/
  29. /* Don't add any code below here or the sky will fall down */
  30. /*-----------------------------------------------------------------------------------*/
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement