Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using a theme that is using Superfish for the navigation menu. The problem is, if the sub item is too long it will drop underneath, i want to keep the individual menu item's text on one line.

Now i've found supersubs for the superfish menu but i don't know how to add it to the theme.

This is in the functions.php file.

wp_enqueue_script('superfish', get_stylesheet_directory_uri() . '/js/superfish.js');

and this is in the header.php file.

<script type="text/javascript">
jQuery(function($){
$(document).ready(function(){
//Drop Down Menu
$('ul.sf-menu').superfish({ 
    delay: 1000,
    animation: {opacity:'show',height:'show'},
    speed: 'normal',
    autoArrows:  true,
    dropShadows: false
    });
});
});
</script>

How can i add supersubs to the menu as well to solve the problem i'm having with the sub items.

Thanks

share|improve this question
add comment

1 Answer 1

Have you tried adding this to the themes functions.php?

 function add_supersubs() {
    wp_enqueue_script('superfish', get_stylesheet_directory_uri() . '/js/superfish.js');
    wp_register_script('supersubs', get_stylesheet_directory_uri() . '/js/supersubs.js','superfish');
    wp_enqueue_script('supersubs');
  }    

add_action('wp_enqueue_scripts', 'add_supersubs'); //

this assumes the supersubs.js is in the js folder of the main theme directory.

You'll also need to modify the header js to fit supersubs.

share|improve this answer
2  
I would recommend putting the register/enqueue functions for supersubs in the same callback as the enqueue for superfish, just for clarity. Also, it might be useful to make superfish a dependency for supersubs? –  Chip Bennett Feb 26 '12 at 19:34
    
Thanks BandonRandon, but what about the header.php. What do i put in there? –  Corbula Feb 26 '12 at 20:53
    
@Corbula I've never used supersubs but the docs seem to help you out here users.tpg.com.au/j_birch/plugins/superfish/#examples (see example 5) –  BandonRandon Feb 28 '12 at 17:14
    
@ChipBennett I agree, just without the callback it's hard to do that :) –  BandonRandon Feb 28 '12 at 17:15
    
@BandonRandon well, you could always move the superfish enqueue into the callback you're creating. :) –  Chip Bennett Feb 28 '12 at 17:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.