Title: top bar plugin
Last modified: August 19, 2016

---

# top bar plugin

 *  [jawker](https://wordpress.org/support/users/jawker/)
 * (@jawker)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/top-bar-plugin/)
 * hello guys,
 * i’m new here. i recently found something very useful that i can use for my site.
   it adds a top bar to my page. however, the plugin is not free. is there any other
   similar plugins (or any ways) for me to do that on my site?
 * eg: [http://www.maxblogpress.com/plugins/msa/](http://www.maxblogpress.com/plugins/msa/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [jawker](https://wordpress.org/support/users/jawker/)
 * (@jawker)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790102)
 * bump
 *  [Roger Theriault](https://wordpress.org/support/users/rogertheriault/)
 * (@rogertheriault)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790107)
 * You don’t need a plugin for a widgetized top bar, you just need to set it up 
   in your template.
 * Put this in your **theme**‘s functions.php file (you may already see part of 
   it there…):
 *     ```
       if ( function_exists('register_sidebar') )
           register_sidebar(array( 'name' => 'sidebar',
               'before_widget' => '<li id="%1$s" class="widget %2$s">',
               'after_widget' => '</li>',
               'before_title' => '<h2 class="widgettitle">',
               'after_title' => '</h2>',
           ));
           register_sidebar(array( 'name' => 'topbar',
               'before_widget' => '<li id="%1$s" class="widget %2$s">',
               'after_widget' => '</li>',
               'before_title' => '<h2 class="widgettitle">',
               'after_title' => '</h2>',
           ));
       }
       ```
   
 * and in your header.php or wherever your top horizontal “bar” needs to go:
 *     ```
       <?php if ( !function_exists('dynamic_sidebar') ||
                  !dynamic_sidebar('topbar') ) { ?>
            <p>Oops... this displays if the topbar is not set up</p>
       <?php } ?>
       ```
   
 * You should see two choices in the Widgets dropdown, sidebar and topbar. You can
   use whatever names you like, and add more if you want… bottom bar, floating bar,
   tiki bar… have fun.
 *  [cinematic](https://wordpress.org/support/users/cinematic/)
 * (@cinematic)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790114)
 * Hi Roger, thanks for this useful tip! Just curious .. do you know what %1$s (
   the class of the li-element) stands for?
 *  [Roger Theriault](https://wordpress.org/support/users/rogertheriault/)
 * (@rogertheriault)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790122)
 * The %n$s are php placeholders for the printf function. Arguments 1 and 2 represent
   something the dynamic sidebar system inserts when it generates each widget for
   that sidebar area at runtime…
 * Typically 1 is the unique identifier of the widget, eg “text-1”
    And 2 is the
   class for the specific widget, eg “widget_text”.
 * They allow you to style a particular widget differently using CSS, or do more
   radical things with jQuery.
 * So I don’t recommend changing them. You might consider adding a class (separated
   by a space) such as “topwidget” if you need to generally style things in that
   area differently, although there are other ways to do that without adding a class.
 *  [cinematic](https://wordpress.org/support/users/cinematic/)
 * (@cinematic)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790160)
 * Thank you very much for the info!
 *  [Abid Omar](https://wordpress.org/support/users/omarabid/)
 * (@omarabid)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790194)
 * you have an error on your code! an additional } on the first snippet
    thanks!
   it was very useful
 *  [Roger Theriault](https://wordpress.org/support/users/rogertheriault/)
 * (@rogertheriault)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790195)
 * You mean a { like this:
 *     ```
       if ( function_exists('register_sidebar') )  {
       ```
   
 *  [playxchange](https://wordpress.org/support/users/playxchange/)
 * (@playxchange)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790239)
 * Awesome stuff, works like a charm 🙂
    Thank you, Roger!
 *  [prasdude](https://wordpress.org/support/users/prasdude/)
 * (@prasdude)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790275)
 * thnx roger it worked!!! its cool!!
    but how do i make the widgets next to each
   other instead below one another??
 * thnx
 *  [mikegoodstadt](https://wordpress.org/support/users/mikegoodstadt/)
 * (@mikegoodstadt)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790277)
 * 2 Questions about using the code in a child theme of Thematic which is already
   widgetized.
 * 1. I only want to add a ‘topbar’ so should I use the following code in to the
   child’s funtion.php:
 *     ```
       if ( function_exists('register_sidebar') ) {
           register_sidebar(array( 'name' => 'topbar',
               'before_widget' => '<li id="%1$s" class="widget %2$s">',
               'after_widget' => '',
               'before_title' => '<h2 class="widgettitle">',
               'after_title' => '</h2>',
           ));
       }
       ```
   
 * And then add the other piece of code just as you wrote it into the child’s header.
   php.
 * 2. When I add your code to a child theme funtions.php it pops the new area in
   at the top of the list. This displaces the widgets ‘owned’ by each area by one
   as follows:
    BEFORE
 *     ```
       primary aside: categories
       secondary aside: links
       other area: anotherwidget
       etc
       ```
   
 * AFTER
 *     ```
       topbar: categories
       primary aside: links
       secondary aside: anotherwidget
       etc
       ```
   
 * I am no PHP expert so I am right in thinking that this is caused by the Array
   command adding the new values in at the _start_ of the existing array?
    Is so
   an you advise however add the new area at the end of the array?
 * Many thanks,
    Mike
 *  [Roger Theriault](https://wordpress.org/support/users/rogertheriault/)
 * (@rogertheriault)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790293)
 * [@mikegoodstadt](https://wordpress.org/support/users/mikegoodstadt/) – #1 – yes,
   you only need to register your topbar if there’s just one.
 * #2 – not sure what the issue really is – I probably need a picture – but the 
   array you see is just a way PHP collects and passes all the parameters. ‘topbar’
   is the name of the sidebar you’re setting up. The rest is what XHTML to put around
   the widgets IF they are output.
 * On the Widgets page you assign widgets to specific sidebars, then set them up.
 * Wherever you call `dynamic_sidebar('topbar')` it will insert the widgets for 
   that sidebar – ie ‘topbar’. You should usually only call it once for each sidebar,
   where you need it.
 * Some older code fails to name the sidebars; in that case you can fix things by
   inserting a name in both places – ie dynamic_sidebar() and register_sidebar()–
   for each of the sidebars. Otherwise, yes, calling dynamic_sidebar() without a
   string parameter might just output the next sidebar in the order they were defined.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘top bar plugin’ is closed to new replies.

 * 11 replies
 * 7 participants
 * Last reply from: [Roger Theriault](https://wordpress.org/support/users/rogertheriault/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/top-bar-plugin/#post-790293)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
