Here is my header.php file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' /> 
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Ubuntu:400,500,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,900" rel="stylesheet">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<script src="<?php bloginfo('template_directory'); ?>/js/jquery.js"></script>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>

<header id="header">
  <div class="container">
    <div class="row">
      <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 text-center">
        <a href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/razz-by-jenifa.png" border="0"  alt="" /></a>
      <div class="col-lg-7 col-md-7 col-sm-12 col-xs-12">
        <div class="row">
          <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 regis-sec">
              <li><a href="#">Register Account</a></li>
              <li><a href="#">Cart (0)</a></li>

        <div class="row">
          <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
            <h4>It's about women. It's about beauty. It's about time.</h4>
            <?php get_search_form(); ?>
          <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
            <p style="margin-top:25px;" class="call">Please Call Us:<br />+1 (929) 266-2100</p>

      <div class="col-lg-1 col-md-1 col-sm-12 col-xs-12"></div>

<div id="section2">
  <div class="container">
    <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">

        <nav class="navbar navbar-default">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar top-bar"></span>
          <span class="icon-bar middle-bar"></span>
          <span class="icon-bar bottom-bar"></span>


            wp_nav_menu( array(
                'menu'              => 'primary',
                'theme_location'    => 'primary',
                'depth'             => 2,
                'container'         => 'div',
                'container_class'   => 'collapse navbar-collapse',
                'container_id'      => 'navbar',
                'menu_class'        => 'nav navbar-nav',
                'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                'walker'            => new wp_bootstrap_navwalker())

<!--/.nav-collapse -->
    </div><!--/.container-fluid -->


<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
    <ul class="nav navbar-right">
        <li><a href="#">JOIN THE RAZZ CLUB</a></li>


Here is my function.php file coding


if ( function_exists('register_sidebar') ) {

'name' => 'Sidebar',
'before_widget' => '<li id="%1$s" class="widget">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',


// Register Custom Navigation Walker

register_nav_menus( array(
    'primary' => __( 'Top Navigation', 'sudipta' ),
    'footermenu' => __( 'Footer Navigation', 'sudipta' ),

) );

add_theme_support( 'post-thumbnails' );

    function show_avatar($comment, $size)
  {                  $email=strtolower(trim($comment->comment_author_email));
   $rating = "G"; // [G | PG | R | X]
       if (function_exists('get_avatar')) {
    echo get_avatar($email, $size);
 } else {
        $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=
       " . md5($emaill) . "&size=" . $size."&rating=".$rating;
    echo "<img src='$grav_url'/>";
 }         }
function my_wp_trim_excerpt($text) { // Fakes an excerpt if needed
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);

// Get the star html code
preg_match("/\<\/p\>.*?(\<div.*?raterclear\"\>.*\<\/div\>.*\<\/div\>)/is", $text, $matches);
$starCode = isset($matches[1])?$matches[1]:'';   
$text = str_replace($starCode, "", $text);

$text = strip_tags($text, '<p>');
$excerpt_length = 80;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_push($words, '[...]');
$text = implode(' ', $words);
// THEME MODIFICATION - added '. $starCode'
return $text . $starCode;
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'my_wp_trim_excerpt');


Also I have added https://github.com/twittem/wp-bootstrap-navwalker this file into the same place, where the header.php, function.php file are.

But after using those coding, it is showing

Fatal error: Class 'wp_bootstrap_navwalker' not found in /home/razzby/public_html/wp-content/themes/razz/header.php on line 79 

Can anyone tell me, how I will solve it?

  • 1
    Have you included the BootStrap NaV Walker class file in anywhere by using include or include_once or require or require_once ? – CodeMascot Dec 10 '16 at 20:11

As hinted at by the comment from the_dramatist, it is not enough to simply add the nav walker class file to your file structure. You must also load the file somewhere, typically in the theme's functions file or a common include.

Your nav walker class, path and filename will vary so update accordingly:

require get_template_directory() . '/inc/main-header-navigation-menu-walker.php';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy