Home / template / WordPress 3.0 menu activation
  • How to WordPress 3.0 menu activation

    no thumbnail sorry: WordPress 3.0 menu activation

    Adding this code snippet to your wordpress theme will activate the new wordpress 3.0 menu system.

    ( click code to copy )

    wordpress snippet : PHP - functions.php

    <>
    register_nav_menus(
          array(
                   'header-menu' => __( 'Header Menu' ),
                   'footer-menu' => __( 'Footer Menu' ),
                 )
           );
    // if no menu pressent fallback to.... used in wp_nav_menu
    function header_fallback() {
                  echo '<div class="sf-menu-wrapper group"><ul class="sf-menu">';
                  wp_list_pages('title_li=');
                  echo '</ul></div>';
    }
    function footer_fallback() {
                  echo '<div id="footer-nav-wrapper" class="group"><ul id="footer-nav">';
                  wp_list_pages('depth=1&title_li=');
                  echo '</ul></div>';
    }
    
    ( click code to copy )

    wordpress snippet : PHP - theme

    <>
    <?php wp_nav_menu(array('theme_location'=>'header-menu','container_class'=>'sf-menu-wrapper group','menu_class'=>'sf-menu','fallback_cb'=>'header_fallback')); ?>
    <?php wp_nav_menu(array('theme_location'=>'footer-menu','container_id'=>'footer-nav-wrapper','container_class'=>'group','menu_id'=>'footer-nav','fallback_cb'=>'footer_fallback')); ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    wp_list_pages, register, register_nav_menu, register_nav_menus, wp_nav_menu, __, _n, wp,
  • Pingback: Tweets that mention Wordpress Wordpress 3.0 menu activation – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com()

  • Braintrash

    When trying to log into the admin area, this is what I get. Any idea?

    register_nav_menus( array( ‘header-menu’ => __( ‘Header Menu’ ), ‘footer-menu’ => __( ‘Footer Menu’ ), ) ); // if no menu pressent fallback to…. used in wp_nav_menu function header_fallback() { echo ‘
    ‘; wp_list_pages(‘title_li=’); echo ‘
    ‘; } function footer_fallback() { echo ‘
    ‘; wp_list_pages(‘depth=1&title_li=’); echo ‘
    ‘; }

    Warning
    : Cannot modify header information – headers already sent by (output started at /var/www/clients/client9/web7/web/wp-content/themes/ServiceCulturel/functions.php:11) in

    /var/www/clients/client9/web7/web/wp-login.php

    on line

    354

    Warning
    : Cannot modify header information – headers already sent by (output started at /var/www/clients/client9/web7/web/wp-content/themes/ServiceCulturel/functions.php:11) in

    /var/www/clients/client9/web7/web/wp-login.php

    on line

    366

    Warning
    : Cannot modify header information – headers already sent by (output started at /var/www/clients/client9/web7/web/wp-content/themes/ServiceCulturel/functions.php:11) in

    /var/www/clients/client9/web7/web/wp-includes/pluggable.php

    on line

    693

    Warning
    : Cannot modify header information – headers already sent by (output started at /var/www/clients/client9/web7/web/wp-content/themes/ServiceCulturel/functions.php:11) in

    /var/www/clients/client9/web7/web/wp-includes/pluggable.php

    on line

    694

    Warning
    : Cannot modify header information – headers already sent by (output started at /var/www/clients/client9/web7/web/wp-content/themes/ServiceCulturel/functions.php:11) in

    /var/www/clients/client9/web7/web/wp-includes/pluggable.php

    on line

    695

    Warning
    : Cannot modify header information – headers already sent by (output started at /var/www/clients/client9/web7/web/wp-content/themes/ServiceCulturel/functions.php:11) in

    /var/www/clients/client9/web7/web/wp-includes/pluggable.php

    on line

    897

    • What is the current version of your wordpress install ?

      • Braintrash

        I use the latest, 3.1.2.

        • I just setup the snippet on a pure 3.1.2 wordpress install and get no errors. Did you setup the snippet properly ? the first snippet should be placed within the functions.php and the second snippet you could place within the header.php after the html head tag.

          I would also remove the snippet and see if that fixes the problem if not then it must be something else like a plugin etc,