wordpress网站导航菜单

时间:2015-05-06 07:40:04

标签: wordpress menu navigation

我正在使用自定义主题创建一个wordpress网站。我想为我的主题的index.php文件设置主页链接。当我使用固定链接时,它会更改所有其他链接的链接而无法正常工作。我正在使用wp_nav_menu来获取header.php中的菜单。如何将href指定给主菜单的index.php。任何人都可以帮忙吗?提前谢谢你。

的header.php:



<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="<?php bloginfo("charset"); ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title><?php bloginfo('name'); ?></title>

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,800' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Lato:400,700,300' rel='stylesheet' type='text/css'>
    

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>">
    
    

     </head>

  <body>

    <!-- Static navbar -->
    <div class="navbar navbar-default navbar-static-top" role="navigation">
      <div class="container h-sectionHeader">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>

          <a class="navbar-brand" href="index.php"><img src="<?php echo esc_attr( get_option('logo-setting') ); ?>" class="logo" alt="logo systenics"></a>
        </div>
<!--         <?php bloginfo('template_directory'); ?>/images/logo-systenics.png
 -->        <div class="navbar-collapse collapse">
               <?php 
$defaults = array(
  'theme_location'  => 'primary',
  'menu'            => '',
  'container'       => 'div',
  'container_class' => '',
  'container_id'    => '',
  'menu_class'      => 'nav navbar-nav',
  'menu_id'         => '',
  'echo'            => true,
  'fallback_cb'     => 'wp_page_menu',
  'before'          => '',
  'after'           => '',
  'link_before'     => '',
  'link_after'      => '',
  'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
  'depth'           => 0,
  'walker'          => ''
);

wp_nav_menu( $defaults ); ?>
         </div><!--/.nav-collapse -->
      </div>
    </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

在word中按管理面板转到外观&gt;&gt;菜单

当您点击查看所有可以看到主页链接时,页面部分中有默认主页。哪个是重定向到index.php.you可以将它拖到你的主菜单。!

enter image description here