“Gravitation is not responsible for people falling in love.”
– Albert Einstein


Superfish for WordPress

Header.php

<!--
  replace "WP_STYLESHEET_DIRECTORY" with this 
    <?php bloginfo('stylesheet_directory'); ?> 
  Need to bring your own minified (not packed) jquery version, 
  some bug that it didn't work using WP jquery package
-->
<script src="WP_STYLESHEET_DIRECTORY/javascript/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="WP_STYLESHEET_DIRECTORY/javascript/superfish.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
        $('ul.sf-menu').superfish();
});
</script>
<link rel="stylesheet" href="WP_STYLESHEET_DIRECTORY/superfish.css" type="text/css" />
echo '<ul class="sf-menu">';
echo '  <li><a href="' . get_option('home') . '">Home</a></li>';
/** 
 * do not include links 
 * wp_list_pages('title_li=&exclude=590,155,163'); 
 **/
wp_list_pages('title_li=&');
/**
 * or use only specific categories 
 * wp_list_bookmarks('title_li=&categorize=0&category=7'); 
 **/
wp_list_bookmarks('title_li=&'); 
echo '</ul>';

Tags: ,

2 Responses to “Superfish for WordPress”

  1. Neil says:

    Hi,

    I am trying to get Superfish to display properly when using wp_list_pages. Most of the examples I have seen appear to use a “static” menu.

    I am new to WordPress and PHP – so please bear with me.

    Why do you have “Echo” in your header file for the menu. Just wondering does this male a difference to Superfish?

    Mine file is as follows:

  2. Marvin says:

    Hi, its just the same as <ul class="sf-menu"></ul> saved as HTML. Then in between that, wp_list_pages() enclosed in php wraps.

Leave a Reply