• I have a WordPress 3 theme I’d like to submit to the free download repository.

    I’ve checked it with all the sample data and debugged it locally, but I’m curious what the best method is for showing the menus. Is there a specific call to register_nav_menus that I need to add?

    When I load the theme in a vanilla installation, my menu items don’t display. It’s kind of a big part of the design so I’d hate to demo it with no menus.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Have you tried looking at the TwentyTen theme for examples of nav menus?

    Thread Starter simplethemes

    (@simplethemes)

    Thanks, I found this page which outlines the fallback process a little better. https://www.nkuttler.de/2010/06/08/wp_nav_menu-wordpress-3-0/

    For anyone else with this same dilemma, I’ve posted my code for reference:

    header.php:

    <!-- begin navigation -->
    <div id="navwrap">
      <div id="nav">
        <?php st_navbar(); ?>
      </div><!--/nav-->
    </div>
    <!--/end navigation-->

    functions.php:
    (sthemes_topmenupages and sthemes_topmenucats assumes a fallback theme admin panel option is also used to output comma separated values)

    // WP 3.0 Menus
    
    function mytheme_addmenus() {
        register_nav_menu('top-menu', 'Primary Navigation');
    }
    add_action( 'init', 'mytheme_addmenus' );
    
    function st_navbar() {
        if (function_exists('wp_nav_menu' ))
          wp_nav_menu( 'menu=top-menu&depth=2&menu_class=sf-menu sf-navbar&fallback_cb=st_navbar_fallback' );
        else
          st_navbar_fallback();
    }
    
    function st_navbar_fallback() {
      $topmenupages = array(
      'include'      => get_option('sthemes_topmenupages'),
      'depth'        => 3,
      'sort_column'  => menu_order,
      'hierarchical' => true,
      'title_li'     => __('')
      );
      $topmenucats = array(
      'include'      => get_option('sthemes_topmenucats'),
      'depth'        => 2,
      'title_li'     => __('')
      );
      echo "<ul class=\"sf-menu sf-navbar\">";?>
      <li <?php if ( is_home() ) { ?>class="current_page_item"<?php } ?>>
      <a href="<?php echo get_option('home'); ?>/"><?php _e ('Home', 'smpl') ?></a>
      </li>
      <?php
      wp_list_pages($topmenupages);
      wp_list_categories($topmenucats);
      echo "</ul></div></div>";
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Submitting a Theme to WordPress’ is closed to new replies.