You put it in your child theme’s functions.php. If this is the first customization done using a custom function, your child theme’s functions.php should be empty, having only one line:
<?php
which opens up php mode, but no actual php code. So basically this is how your child theme functions.php should look like after you add the code above:
<?php
add_action( 'init', 'register_secondary_menu' );
function register_secondary_menu() {
if ( function_exists( 'register_nav_menu' ) ) {
register_nav_menu( 'secondary-menu', 'Secondary Menu' );
}
}
add_action('__header', 'display_secondary_menu', 1000, 0);
function display_secondary_menu() {
echo ( has_nav_menu( 'secondary-menu' ) ? wp_nav_menu (
array (
'theme_location' => 'secondary-menu',
'container_id' => 'secondary-menu',
'container_class' => 'secondary-menu'
)
).'<div class="clearall"></div>' : '' );
}
The css should be added in style.css of the child theme or in the custom CSS panel in theme customizations page. If you don’t already have a child theme, you should make one (read about how to make one on theme’s webpage, in tutorials).
Please note that in the initial code I added the display menu function as a filter on “__header”. I realized when looking over the code again that it should be done as an action in this case, not as a filter. It works both ways, but since I’m not filtering anything, just adding code to the header, it should be done through action. I also believe it’s a bit faster. Anyway, the code from this post has been updated.