skip to Main Content

I wan’t to use Bootstrap Navigation in WordPress.
I put bootstrap into the File functions.php.
But the navigation even did not work (in header.php)?

This is where I want to add bootstrap:

<!-- site navigation menu-->
        <nav class="nav nav-pills site-nav">
            <?php wp_nav_menu(); ?>
        </nav><!-- site navigation menu-->

2

Answers


  1. brother you have to import bootstrap css in the style.css and it works fine in the template or for function.php

     function theme_styles() {
    
    wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() .    '/css/bootstrap-3.3.7.css' );
    wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );
    

    }

    add_action( ‘wp_enqueue_scripts’, ‘theme_styles’);

    function theme_js() {

    global $wp_scripts;
    
    wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js' );
    wp_enqueue_script( 'my_custom_js', get_template_directory_uri() . '/js/scripts.js');
    

    }

    add_action( ‘wp_enqueue_scripts’, ‘theme_js’);

    Login or Signup to reply.
  2. I can recommend wp-bootstrap-navwalker:

    A custom WordPress nav walker class to fully implement the Twitter
    Bootstrap 3.0+ navigation style in a custom theme using the WordPress
    built in menu manager.

    Check out the documentation:

    https://github.com/wp-bootstrap/wp-bootstrap-navwalker

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search