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.

So I am using Rachel Baker's open source BootstrapWP starter theme to develop a Wordpress theme. There is a repository on Github but I didn't think this question was appropriate to post there.

I am trying to get the header to be static but I am unsure of how to make it work. I have found a working example that achieves this with this theme but I can only see the HTML output as an example. I am a novice Wordpress coder just trying to figure things out. I cannot see or figure out what is the best way to achieve this.

So on the example site where this feature is working the HTML being output by the header.php file has different classes of the header so that depending on where the browser is the correct header will be displayed. It outputs three separate nav-menu lists in the HTML. The first nav-menu starts with <li id="" > and the following two don't have an id, they only have <li class="">.

Here is a pic: ( Or just see the pastebin shared below)

enter image description here

Here is a pastebin of this code including the jquery script being used.

I am assuming that this can be achieved with the wp_nav_menu php code in the header but I wasn't sure how to do this.

                <?php wp_nav_menu(
                        array(
                        'menu' => 'main-menu',
                        'container_class' => 'nav-collapse collapse left-aligned nav-collapse-main',
                        'menu_class' => 'nav',
                        'fallback_cb' => '',
                        'menu_id' => 'main-menu',
                        'walker' => new Bootstrapwp_Walker_Nav_Menu()
                    )
                ); ?>

Theme has a Custom Walker file which is in the includes folder, can be easy seen in the Github repo, this site wouldn't let me share more than 2 links per post, sorry.

I've got lots of questions but I think my first one would be, do I need a loop of multiple wp_nav_menu calls or is there a better method? Thought this would be a nice feature for anybody using Bootstrapped Wordpress themes, hope someone can help.

share|improve this question

closed as off-topic by ialocin, kaiser Mar 21 at 0:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

    
Is it just a sticky navbar you are referring to? –  MartinB Mar 20 at 22:13
    
Also, just for reference, there is a warning that BootstrapWP is not supported and should not be used to develop a theme. Perhaps you could look at using 320 Press' implementation WPBS? That has a sticky navbar by default (though the pink background is a little intense). (Also BootstrapWP is using an older version of Bootstrap whereas WPBS is using 3+) –  MartinB Mar 20 at 22:21

1 Answer 1

On line 28 of header.php change the class of the navbar css as follows: Replace the class navbar-relative-top with navbar-fixed-top. Therefore, line 28 becomes

<div class="navbar navbar-inverse navbar-fixed-top">
share|improve this answer

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