I am making my first WordPress theme using Bootstrap. Now I want to create a widget area in the far right of my navbar, so I can add ie. a language selector. I tried with the following code, but nothing appears on my site, or in my source code where the widget should be. Any ideas?
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<div class="row">
<div class="span8">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="<?php echo site_url(); ?>"><?php bloginfo('name'); ?></a>
<div class="nav-collapse collapse">
<ul class="nav">
<?php wp_list_pages(array('title_li' => '', 'exclude' => 4)); ?>
</ul>
</div><!--/.nav-collapse -->
</div>
<div class="span4 navbar-right">
<?php dynamic_sidebar( 'right-top' ); ?></div>
</div>
</div>
</div>
</div>
</div>
Code for registering sidebars in functions.php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Right top',
'id' => 'right-top',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
When you call
register_sidebar
you use the nameRight top
and IDhoyre-top
but then calldynamic_sidebar
with the name/idright-top
which isn’t the ID of that sidebar.Try
or change the id of the sidebar in
register_sidebar
fromhoyre-top
toright-top
.