GithubHelp home page GithubHelp logo

gilbertobotaro / wp-bulma-navwalker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ridgey28/wp-bulma-navwalker

0.0 0.0 0.0 10 KB

A WordPress Bulma NavWalker with Font Awesome Support

License: MIT License

PHP 100.00%

wp-bulma-navwalker's Introduction

WP-Bulma-Navwalker

A WordPress Bulma CSS Framework NavWalker with Font Awesome Support.

Install

Drop the file into your WordPress theme folder and hook up to it in your functions.php

require_once('classes/bulma-navwalker.php');

Setup the Bulma NavBar and wp_nav_menu in header.php. This demo example uses is-fixed-top and navbar-end from the bulma CSS Framework. Please consult the documentation for other options https://bulma.io/documentation/components/navbar/

	<nav class="navbar is-fixed-top" aria-label="main navigation">
		<div class="navbar-brand">
			<a class="navbar-item" href="<?php echo esc_url( home_url( '/' ) );?>">
			 <img alt="My Logo" src="<?php echo get_template_directory_uri();?>/images/my-logo.png">
			</a>

		 <button class="button navbar-burger is-active" data-target="primary-menu" aria-controls="primary-menu" aria-haspopup="true" aria-label="Menu Button" aria-pressed="false">
			 <span aria-hidden="true"></span>
			 <span aria-hidden="true"></span>
			 <span aria-hidden="true"></span>
		 </button>
 </div>

 <div id="primary-menu" class="navbar-menu is-active">
	 <div class="navbar-end">
		 <?php wp_nav_menu(array(
			 'theme-location' => 'header-menu', //change it according to your register_nav_menus() function
			 'depth'		=>	3,
			 'menu'			=>	'NewNav',
			 'container'		=>	'',
			 'menu_class'		=>	'',
			 'items_wrap'		=>	'%3$s',
			 'walker'		=>	new Bulma_NavWalker(),
			 'fallback_cb'		=>	'Bulma_NavWalker::fallback'
		 ));
		 ?>
	 </div>
</div>
</nav>

Configuration

Enqueue Font Awesome in functions.php

function wow_scripts() {
//include other scripts and styles too
	wp_enqueue_script('font-awesome','//use.fontawesome.com/releases/v5.0.13/js/all.js',null,null,true);
}

add_action( 'wp_enqueue_scripts', 'wow_scripts' );

Displaying Font Awesome 5 Icons (Not tested on earlier versions but should work)

Tested on top level navigation links! Find the icon code snippet from https://fontawesome.com/icons?d=gallery Add the snippet into the css class box located in Appearance->Menus

Example:

fas fa-info-circle

Displaying The title Alongside The Icon

Add the class fa-show-title to the css class box Leave it blank if you only want to display the icon

NavBar Divider

Tested on dropdowns Add a custom link using # in the url box Add the class navbar-divider to the css class box

Alignment Class

The class is-right can be used on the farthest dropdown when using the navbar-end class. It simply aligns the dropdown so that is doesn't overflow the page. Simply add is-right to the parent element.

Future Features and Bugfixes

Although I have thoroughly tested the NavWalker if you come across any errors or bugs please report any issues.

Possible Future Features

Integrate Bulma Mega-Menu Search Bar Social Icons etc

wp-bulma-navwalker's People

Contributors

ridgey28 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.