Bootstrap WordPress导航助行器下拉突然无法正常工作

时间:2016-07-31 00:24:50

标签: wordpress twitter-bootstrap wp-nav-walker

我正在慢慢失去理智,试图找出子菜单项突然停止工作的原因。我删除并替换了我能想到的每一段代码和文件,看看问题出在哪里。我希望这对于过去5小时没有盯着代码的人来说是一件非常明显的事情。

的header.php

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php wp_title('|',1,'right'); ?> <?php bloginfo('name');    ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- Fonts -->
<link href="http://fonts.googleapis.com   /css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,3    00,600,700,800" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">

 <!-- Le styles -->
  <link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">

<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">

  <?php wp_enqueue_script("jquery"); ?>
<?php wp_head(); ?>
</head>

<body>
<!-- Header -->
<div class="brand"><img id="logo" class="img-responsive img-center"   src="http://www.gallantrywebdesign.com/mark_reed/images/printing_color_postcards_header.png" width="678" height="200" alt="Printing Color Postcards.com"/></div>
<div class="address-bar"><a href="http://www.gallantrywebdesign.com/wordpress/services/all-postcards/">Marketing Products & Services</a> | <a href="http://www.gallantrywebdesign.com/wordpress/services/sanitation-only/">sanitationpostcards.com</a></div>

 <!-- Navigation -->
 <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
           </button>
       <!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
       <a class="navbar-brand" href="http://www.gallantrywebdesign.com/wordpress/">Printing Color Postcards</a>
       </div>

      <!-- Collect the nav links, forms, and other content for toggling -->
      <?php
        wp_nav_menu( array(
            'menu'              => 'menu',
            'theme_location'    => 'menu',
            'depth'             => 2,
            'container'         => 'div',
            'container_class'   => 'collapse navbar-collapse',
            'container_id'      => 'bs-example-navbar-collapse-1',
            'menu_class'        => 'nav navbar-nav',
            'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
            'walker'            => new wp_bootstrap_navwalker())
         );
        ?>
       </div>
         </nav>

         <?php if( is_home() || is_front_page() ) :?>

         <?php endif;?>
         <div class="container">
          <div class="row">

的functions.php

<?php 

function footer_widgets()  {
 register_sidebar(array(
'name'          => __( 'Footer 1', 'the-bootstrap' ),
'id'            => 'footer-1',
'before_widget' => '<aside class="widget well %2$s" id="%1$s">',
'after_widget'  => '</aside>',
'before_title'  => '<h3 class="widget-title">',
'after_title'   => '</h3>',
 ) );

 register_sidebar(array(
'name'          => __( 'Footer 2', 'the-bootstrap' ),
'id'            => 'footer-2',
'before_widget' => '<aside class="widget well %2$s" id="%1$s">',
'after_widget'  => '</aside>',
'before_title'  => '<h3 class="widget-title">',
'after_title'   => '</h3>',
 ) );

 register_sidebar(array(
'name'          => __( 'Footer 3', 'the-bootstrap' ),
'id'            => 'footer-3',
'before_widget' => '<aside class="widget well %2$s" id="%1$s">',
'after_widget'  => '</aside>',
'before_title'  => '<h3 class="widget-title">',
'after_title'   => '</h3>',
 ) );
 }
 // Hook The 'widgets_init' Action
 add_action( 'widgets_init', 'footer_widgets', 11);


 function wpbootstrap_scripts_with_jquery()
 {

 // Register Custom Navigation Walker
 require_once('wp_bootstrap_navwalker.php');

 register_nav_menus( array(
 'menu' => __( 'Primary Menu', 'wpbootstrap' ),
 ) );

// Register the script like this for a theme:
wp_register_script( 'custom-script', get_template_directory_uri()  .       '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script( 'custom-script' );


}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );

if ( function_exists('register_sidebar') )
register_sidebar(array(
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
));


?>

This is the URL

我不认为这是css,所以我没有在这里发布。我会根据要求。

感谢您的任何见解!

0 个答案:

没有答案