模板和函数中的wordpress3菜单

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了模板和函数中的wordpress3菜单相关的知识,希望对你有一定的参考价值。

Code for enabling custom menus in your theme in WordPress 3. This code is from http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus
  1. <?php
  2. // placed with functions.php
  3. add_action( 'init', 'register_my_menus' );
  4.  
  5. function register_my_menus() {
  6. register_nav_menus(
  7. 'primary-menu' => __( 'Primary Menu' ),
  8. 'secondary-menu' => __( 'Secondary Menu' ),
  9. 'tertiary-menu' => __( 'Tertiary Menu' )
  10. )
  11. );
  12. }
  13. ?>
  14.  
  15.  
  16. // placed within themes template where menu should be located
  17. <?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>

以上是关于模板和函数中的wordpress3菜单的主要内容,如果未能解决你的问题,请参考以下文章