All Projects → jprieton → wp-bootstrap4-navwalker

jprieton / wp-bootstrap4-navwalker

Licence: GPL-3.0 license
A custom WordPress nav walker class to fully implement the Twitter Bootstrap 4.x navigation style in a custom theme using the WordPress built in menu manager

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to wp-bootstrap4-navwalker

Wp Bootstrap Navwalker
A custom WordPress nav walker class to fully implement the Twitter Bootstrap 4.0+ navigation style (v3-branch available for Bootstrap 3) in a custom theme using the WordPress built in menu manager.
Stars: ✭ 3,290 (+8125%)
Mutual labels:  wordpress-theme, walker, wp-bootstrap-navwalker
bsnav
An extended Bootstrap 4 menu with a bunch of utilities
Stars: ✭ 90 (+125%)
Mutual labels:  navbar, bootstrap4
webpack-gulp-wordpress-starter-theme
A WordPress theme with Webpack & Gulp
Stars: ✭ 110 (+175%)
Mutual labels:  wordpress-theme, bootstrap4
wp-bootstrap4-sass
A clean slate Wordpress theme template with Bootstrap(4) Sass.
Stars: ✭ 28 (-30%)
Mutual labels:  wordpress-theme, bootstrap4
Tony
An Elegant WordPress Theme Based on ✌️Vue.js | 基于 Vue.js 的简洁一般强大的 WordPress 单栏博客主题
Stars: ✭ 462 (+1055%)
Mutual labels:  wordpress-theme, bootstrap4
bootplate
Wicked-fast, mobile-first, Bootstrap 4 theme framework for building awesome WordPress websites.
Stars: ✭ 30 (-25%)
Mutual labels:  wordpress-theme, bootstrap4
Materialwp
Material Design WordPress Theme
Stars: ✭ 459 (+1047.5%)
Mutual labels:  wordpress-theme, bootstrap4
StrapPress
Bootstrap 4 WordPress Starter Theme that is Gutenberg Compatible
Stars: ✭ 55 (+37.5%)
Mutual labels:  wordpress-theme, bootstrap4
bootstrap-4-boilerplate
Basic Bootstrap 4 Starter Template
Stars: ✭ 50 (+25%)
Mutual labels:  bootstrap4
JieStyle-One
WordPress Themes
Stars: ✭ 25 (-37.5%)
Mutual labels:  wordpress-theme
frontie
Frontie is a front-end boilerplate. Gulp | Twig.js | Sass | Autoprefixer | Browsersync | Bootstrap 4 Grid System & Responsive Breakpoints
Stars: ✭ 28 (-30%)
Mutual labels:  bootstrap4
Codeigniter-4-CRUD-generator
ADEL CCG is an easy open-source intuitive web app to create AdminLTE4 -Bootstrap 5- dashboards with CRUD operations in php.
Stars: ✭ 87 (+117.5%)
Mutual labels:  bootstrap4
smaller-sites
Smaller Sites is a small BUT Powerful, free and easy to use drag and drop builder for blogs, websites or e-commerce stores. Designed for everyone Developers and non Developers. You can use it to design your next website. The goal is to create something like webflow
Stars: ✭ 27 (-32.5%)
Mutual labels:  bootstrap4
classmanager-student-teacher-portal
A Student-Teacher Portal built using HTML, CSS, Python and Django
Stars: ✭ 155 (+287.5%)
Mutual labels:  bootstrap4
one-bootstrap-template
Flatlogic One - Free Bootstrap Template and Theme
Stars: ✭ 24 (-40%)
Mutual labels:  bootstrap4
CUMS DBMS
🏰 A College Management Site (DBMS) using Node and Mysql.
Stars: ✭ 28 (-30%)
Mutual labels:  bootstrap4
foxer
Foxer starter theme based on _s.
Stars: ✭ 14 (-65%)
Mutual labels:  wordpress-theme
coblocks-theme
WordPress theme for CoBlocks
Stars: ✭ 24 (-40%)
Mutual labels:  wordpress-theme
food-order-app
Simple Food Ordering Website (NodeJS, ExpressJS, MongoDB, Bootstrap) with auto deployment
Stars: ✭ 43 (+7.5%)
Mutual labels:  bootstrap4
qroko
WordPress theme for headless CMS
Stars: ✭ 20 (-50%)
Mutual labels:  wordpress-theme

WP Bootstrap 4.x Navwalker (no longer maintained)

Note: This repository is no longer maintanied, please use wp-bootstrap/wp-bootstrap-navwalker, this class was based on their navwalker for Bootstrap 3.x

A custom WordPress nav walker class based on 3.x version of https://github.com/wp-bootstrap/wp-bootstrap-navwalker/ to fully implement the Twitter Bootstrap 4.x navigation style in a custom theme using the WordPress built in menu manager

Installation

Using it as a plugin

Place wp-bootstrap-navwalker.php in your WordPress plugin folder /wp-content/plugins/wp-bootstrap4-navwalker/ and activate.

...Or using it as a dependency on your theme

Place wp-bootstrap-navwalker.php in your WordPress theme folder /wp-content/your-theme/

Open your WordPress themes functions.php file /wp-content/your-theme/functions.php and add the following code:

// Register Custom Navigation Walker
require_once get_template_directory() . '/wp-bootstrap-navwalker.php';

If you encounter errors with the above code use a check like this to return clean errors to help diagnose the problem.

if ( ! file_exists( get_template_directory() . '/wp-bootstrap-navwalker.php' ) ) {
  // file does not exist... return an error.
  return new WP_Error( 'wp-bootstrap-navwalker-missing', __( 'It appears the wp-bootstrap-navwalker.php file may be missing.', 'wp-bootstrap-navwalker' ) );
} else {
  // file exists... require it.
  require_once get_template_directory . 'wp-bootstrap-navwalker.php';
}

Usage

Update your wp_nav_menu() function in header.php to use the new walker by adding a "walker" item to the wp_nav_menu array.

<?php
wp_nav_menu( array(
    'menu'              => 'primary',
    'theme_location'    => 'primary',
    'depth'             => 2,
    'container'         => 'div',
    'container_id'      => 'navbarNavDropdown',
    '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())
);
?>

Typically the menu is wrapped with additional markup, here is an example of a menu that collapse for responsive navigation.

<?php
$custom_logo = wp_get_attachment_image( get_theme_mod( 'custom_logo' ), 'full' );
?>

<nav class="navbar navbar-light bg-light navbar-expand-lg justify-content-between">

  <a class="navbar-brand" href="<?php echo home_url() ?>">
    <?php echo $custom_logo ?>
  </a>

  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <?php
  wp_nav_menu( array(
      'theme_location'  => 'top-menu',
      'depth'           => 2,
      'container'       => 'div',
      'container_id'    => 'navbarNavDropdown',
      'container_class' => 'collapse navbar-collapse',
      'menu_class'      => 'nav navbar-nav ml-auto',
      'fallback_cb'     => 'WP_Bootstrap_Navwalker::fallback',
      'walker'          => new WP_Bootstrap_Navwalker()
  ) );
  ?>
</nav>

Dividers

Simply add a Link menu item with a URL of # and a Link Text or Title Attribute of divider (case-insensitive so ‘divider’ or ‘Divider’ will both work ) and the class will do the rest.

Notes

If you need add custom texdomain to Add a menu string, in line 316 you can add your textdomain identifier.

Bug tracker

Have a bug? Please create an issue on GitHub at https://github.com/jprieton/wp-bootstrap4-navwalker/issues

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].