I'm making my own custom wordpress theme for the first time and I've hit a snag when trying to register menus.
I've followed a tutorial to build the theme at http://themeshaper.com/2012/10/22/the-themeshaper-wordpress-theme-tutorial-2nd-edition/ and looked it up on http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus but no matter what i do the code that registers the menu won't work as I don't see the menu to add items to in wp-admin. Here's the function I register them in:
if ( ! function_exists( 'eastmids_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* @since eastmids 1.0
*/
function eastmids_setup() {
/**
* Custom template tags for this theme.
*/
require( get_template_directory() . '/inc/template-tags.php' );
/**
* Custom functions that act independently of the theme templates
*/
require( get_template_directory() . '/inc/tweaks.php' );
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
* If you're building a theme based on eastmids, use a find and replace
* to change 'eastmids' to the name of your theme in all the template files
*/
load_theme_textdomain( 'eastmids', get_template_directory() . '/languages' );
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/**
* Enable support for the Aside Post Format
*/
add_theme_support( 'post-formats', array( 'aside' ) );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu' ),
) );
}
endif; // eastmids_setup
add_action( 'after_setup_theme', 'eastmids_setup' );
And here is how I use it:
<nav role="navigation" class="site-navigation main-navigation">
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</nav>
What is displayed instead is an ul tag containing Home followed by my pages.
seeing as i can't see the menus in wp-admin i assume the register is failing somehow.
Can anybody help?