Wordpress Navigation

时间:2013-04-05 作者:pallavi

我的菜单html代码如下:

<div class="menu">
      <ul>
        <li><a href="index.php" >Home</a></li>
        <li><a href="aboutus.php" >About Us</a></li>
        <li><a href="services.php" >Services</a></li>
        <li><a href="success.php" >Success Stories</a></li>
        <li><a href="testimonials.php" >Testimonials</a></li>
        <li><a href="contactus.php" >Contact Us</a></li>
      </ul>
我已在中注册侧栏functions.php 如下所示

<?php
$args = array(
    \'name\'          => __( \'Main Navigation\', \'theme_text_domain\' ),
    \'id\'            => \'sidebar-navigation\',
    \'description\'   => \'Main Navigation Container\',
        \'class\'         => \'\',
    \'before_widget\' => \'<div>\',
    \'after_widget\'  => \'</div>\',
    \'before_title\'  => \'<h2 class="widgettitle">\',
    \'after_title\'   => \'</h2>\' );
    register_sidebar( $args );

?>
之后,我调用了动态侧栏header.php 文件为

<?php dynamic_sidebar(\'sidebar-navigation\'); ?>
但我看不到菜单出现。

1 个回复
SO网友:Overdose

你应该这样钩住它:

function customwidget_init()
{
$args = array(
    \'name\'          => __( \'Main Navigation\', \'theme_text_domain\' ),
    \'id\'            => \'sidebar-navigation\',
    \'description\'   => \'Main Navigation Container\',
        \'class\'         => \'\',
    \'before_widget\' => \'<div>\',
    \'after_widget\'  => \'</div>\',
    \'before_title\'  => \'<h2 class="widgettitle">\',
    \'after_title\'   => \'</h2>\' );
    register_sidebar( $args );
}
add_action( \'widgets_init\', \'customwidget_init\');
请参见Codex 描述

结束

相关推荐

REGISTER_NAV_MENUS和wp_NAV_MENU问题,不显示独立菜单

我的问题是wordpress没有将两个菜单显示为单独的菜单,它只是将菜单上的内容输出到两个位置。URL:http://www.msc-media.co.uk检查页眉和页脚的链接-我知道页脚很难看,以后需要整理css。我在函数中创建了两个菜单。php使用此代码。<?php register_nav_menus( array( \'topmenu\' => \'Top Menu\', \'footermenu\' => \'Fo