Sticky Menu, a plugin for WordPress

July 6th, 2007 ericdes

I wrote this little plugin to easily create menus in WordPress.

Normal use of WordPress to create menus:

Because WordPress normally creates menus automatically, for example from a list of categories or pages, you have to exclude manually all items you don’t want in your menu, which can be a lengthy process if you have a lot of categories or pages.

Also, you can’t mix categories and pages in a same menu. You can’t put a link to a subdomain, which could be the case if you have a forum running outside WordPress for example.

What Sticky Menu improves:

Sticky Menu lets you define an unlimited number of menus, in which

you list the exact number of menu items you want to appear. Menu items can link to any pages, posts, etc., in your site or any URLs exterior to your site. You can define a class name for each menu item.

With Sticky Menu being activated, you go to the admin board and look for Sticky Menu in the ‘Manage’ section. There, you create as many menus and menu items as you’d like. In this example, I created a menu named ‘Main’ with 4 menu items: Home, Fun, About me, Contact me.

Sticky Menu's screenshot - Click to enlarge
Then I edited the template files header.php, footer.php, sidebar.php to add these lines:

$menu = new stickymenu;
$menu->display_menu('menu=Main'); # Will display menu 'Main' here

Sticky Menu - See the result!

(Please note that the names are case-sensitive, e.g. ‘Main’ is different than ‘main’.)


5/21/2008: Sticky Menu 1.41 - Fixed type bug related to ‘class’ field.

Download links to the Sticky Menu plugin:

Sticky Menu 1.41 (tar.gz)

Sticky Menu 1.41 (.zip)


Sticky Menu Download Area (History)

Entry Filed under: WordPress plugins

230 Comments Add your own

Pages: « 2311 10 9 8 7 [6] 5 4 3 2 1 »

  • 60. Roulie  |  August 24th, 2006 at 11:08 am

    Thanks but I did what you told me and it didn’t change anything…

    I modified my header.php file and I changed my style.css and my menu still be vertical.

  • 59. tela  |  August 24th, 2006 at 9:20 am

    Roulie:

    To create a horizontal list, you have to:

    - add all the css code in your stylesheet, style.css (it doesn’t really matter where you put these lines in style.css) :

    ul#navlist {
    margin-left: 0;
    padding-left: 0;
    white-space: nowrap;
    }
    
    ul#navlist li {
    display: inline;
    list-style-type: none;
    }
    
    ul#navlist li a { padding: 3px 10px; }
    
    ul#navlist li a:link, ul#navlist li a:visited {
    color: #fff;
    background-color: #036;
    text-decoration: none;
    }
    
    ul#navlist li a:hover {
    color: #fff;
    background-color: #369;
    text-decoration: none;
    }

    (css example from Listamatic: Rollover horizontal list)

    - wrap the code for Sticky Menu in your template header.php with the selector #navlist:

    <ul id="navlist">
    <?php $menu = new stickymenu; ?>
    <?php $menu->display_menu('menu=Main'); ?>
    </ul>

  • 58. Roulie  |  August 23rd, 2006 at 9:23 pm

    Hello,
    nice plugin!

    I still have a problem to modify my style.css file. I’m looking to create a Horizontal List but I don’t understand where I have to wrap :
    #navlist li
    {
    display: inline;
    list-style-type: none;
    }
    Could you help me

  • 57. tela  |  August 22nd, 2006 at 12:04 pm

    Pascal:

    To use Sticky Menu, you have to check different things :
    - make sure the plugin is activated,
    - create your menu in the admin section (under Manage > Sticky Menus): make sure your menu’s name is “Main” as in the code you put in header.php.

    Once this is done, your menu should display on your header.

  • 56. pascal  |  August 22nd, 2006 at 11:35 am

    aaaargh i can’t put my code in the post !

    <?php $menu = new stickymenu; ?>
    <?php $menu->display_menu('menu=Main'); ?>
    

  • 55. pascal  |  August 22nd, 2006 at 11:35 am

    Sorry for my previous message, the code is :

    <?php display_menu('menu=Main'); ?>

  • 54. pascal  |  August 22nd, 2006 at 11:34 am

    Hi all,
    i’m a real newbie with php, and i really don’t understand how to use sticky menu. The plugin is installed, and i want to put my menu in the header.
    I tried this :
    <?php display_menu('menu=Main'); ?>
    But nothing happens…
    Can somebody help me ?

  • 53. tela  |  August 18th, 2006 at 10:51 am

    Hello Michael,
    You have to wrap the code for Sticky Menu with :

    <div id="navcontainer">
    <ul id="navlist">
    Code for Sticky Menu
    </ul>
    </div>
    

    Sticky Menu outputs <li></li> for each menu item. But as for now it doesn’t output a class for the current item.

  • 52. Michael  |  August 17th, 2006 at 3:54 am

    Assuming this site is using your Sticky Menu, I see you have when I view your HTML source for the links above (Home, WordPress, Contact Us).

    But the HTML code that Sticky Menu creates for me just starts with the a regular :

    Home
    About

    So how can I reference the Sticky Code HTML from style.css unless the Sticky Code plugin creates the code? I get the list on my site (freetechconnection.com) but I don’t know how to reference it from style.css?

    Thanks…

  • 51. Michael  |  August 17th, 2006 at 3:01 am

    I went to Listamatic as you suggested to create a Horizontal List, but could you give an example of the exact CSS code I would need to add to “style.css” for the example Menu you created? Do I need to add in the HTML as shown at Listamatic, or just the CSS?

    http://css.maxdesign.com.au/listamatic/horizontal02.htm

    Thanks!!

Pages: « 2311 10 9 8 7 [6] 5 4 3 2 1 »

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed