Skip to content

Commit 4c2ae91

Browse files
committed
Merge branch 'master' into update/change-composer-package-type
2 parents d84220a + c98c669 commit 4c2ae91

File tree

7 files changed

+249
-173
lines changed

7 files changed

+249
-173
lines changed

.travis.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: php
2+
dist: trusty
23

34
notifications:
45
email:
@@ -10,24 +11,31 @@ branches:
1011
- master
1112

1213
php:
13-
- 5.3
1414
- 5.6
1515
- 7.0
16+
- nightly
1617

1718
env:
1819
- WP_VERSION=latest WP_MULTISITE=0
20+
- WP_VERSION=latest WP_MULTISITE=1
1921

2022
matrix:
2123
include:
22-
- php: 5.3
24+
- dist: precise
25+
php: 5.3
26+
env: WP_VERSION=latest WP_MULTISITE=0
27+
- dist: precise
28+
php: 5.3
2329
env: WP_VERSION=latest WP_MULTISITE=1
30+
allow_failures:
31+
- php: nightly
2432

2533
before_script:
26-
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
34+
- bash bin/install-wp-tests.sh wordpress_test root "" localhost $WP_VERSION
2735
- export PATH="$HOME/.composer/vendor/bin:$PATH"
2836
- |
29-
if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then
30-
composer global require "phpunit/phpunit=5.6.*"
37+
if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then
38+
composer global require "phpunit/phpunit=^5.6"
3139
else
3240
composer global require "phpunit/phpunit=4.8.*"
3341
fi
@@ -36,5 +44,9 @@ before_script:
3644
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
3745
3846
script:
39-
- phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
47+
- phpcs --standard=phpcs.ruleset.xml $(find -name "*.php")
4048
- phpunit
49+
50+
cache:
51+
directories:
52+
- $HOME/.composer/cache

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [3.0.0]
44

5+
- Fix untranslated string in fallback.
6+
- Instruct screenreaders to ignore icons when present.
7+
- Added basic unit tests and travis config.
8+
- Swapped to IF statements with curly braces.
9+
- Adds `$depth` arg for nav_menu_css_class filter.
10+
- Fix sanitization function used for class output in fallback.
511
- Changed composer package type to `library` from `wordpress-plugin`.
612

713
## [2.0.5] - 2016-011-15

README.md

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
[![Code Coverage](https://scrutinizer-ci.com/g/wp-bootstrap/wp-bootstrap-navwalker/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/wp-bootstrap/wp-bootstrap-navwalker/?branch=master)
99
[![Build Status](https://scrutinizer-ci.com/g/wp-bootstrap/wp-bootstrap-navwalker/badges/build.png?b=master)](https://scrutinizer-ci.com/g/wp-bootstrap/wp-bootstrap-navwalker/build-status/master)
1010

11-
A custom WordPress nav walker class to fully implement the Bootstrap 3.0+ navigation style in a custom theme using the WordPress built in menu manager.
11+
A custom WordPress nav walker class to fully implement the Bootstrap 3.0+ navigation style in a custom theme using the WordPress built in menu manager. A working version of the walker for Bootstrap 4.0.0 can be found in the [`v4` branch](https://github.com/wp-bootstrap/wp-bootstrap-navwalker/tree/v4)
1212

1313
## NOTES
1414

15-
This is a utility class that is intended to format your WordPress theme menu with the correct syntax and classes to utilize the Bootstrap dropdown navigation, and does not include the required Bootstrap JS files. You will have to include them manually.
15+
This is a utility class that is intended to format your WordPress theme menu with the correct syntax and classes to utilize the Bootstrap dropdown navigation. It does not include the required Bootstrap JS and CSS files. You will have to include those dependancies separately.
1616

1717
### Bootstrap 4
1818

19-
Bootstrap 4 beta is available and is now the default branch offered at the GitHub repo and on [GetBootstrap](https://getbootstrap.com). A working version of the walker for Bootstrap 4 can be found in the `v4` branch.
20-
21-
Acording to @mdo & team:
22-
23-
> Long story short, shipping a beta means we’re done breaking all your stuff until our next major version (v5).
19+
Bootstrap 4.0.0 released January 2018 and is the default branch offered at the GitHub repo and on [GetBootstrap](https://getbootstrap.com).
2420

2521
## Installation
2622

@@ -29,19 +25,21 @@ Place **wp-bootstrap-navwalker.php** in your WordPress theme folder `/wp-content
2925
Open your WordPress themes **functions.php** file `/wp-content/your-theme/functions.php` and add the following code:
3026

3127
```php
28+
<?php
3229
// Register Custom Navigation Walker
3330
require_once get_template_directory() . '/wp-bootstrap-navwalker.php';
3431
```
3532

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

3835
```php
36+
<?php
3937
if ( ! file_exists( get_template_directory() . '/wp-bootstrap-navwalker.php' ) ) {
4038
// file does not exist... return an error.
4139
return new WP_Error( 'wp-bootstrap-navwalker-missing', __( 'It appears the wp-bootstrap-navwalker.php file may be missing.', 'wp-bootstrap-navwalker' ) );
4240
} else {
4341
// file exists... require it.
44-
require_once get_template_directory . 'wp-bootstrap-navwalker.php';
42+
require_once get_template_directory() . '/wp-bootstrap-navwalker.php';
4543
}
4644
```
4745

@@ -50,61 +48,58 @@ if ( ! file_exists( get_template_directory() . '/wp-bootstrap-navwalker.php' ) )
5048
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.
5149

5250
```php
53-
<?php
54-
wp_nav_menu( array(
55-
'menu' => 'primary',
56-
'theme_location' => 'primary',
57-
'depth' => 2,
58-
'container' => 'div',
59-
'container_class' => 'collapse navbar-collapse',
60-
'container_id' => 'bs-example-navbar-collapse-1',
61-
'menu_class' => 'nav navbar-nav',
62-
'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
63-
'walker' => new WP_Bootstrap_Navwalker())
64-
);
65-
?>
51+
<?php
52+
wp_nav_menu( array(
53+
'theme_location' => 'primary',
54+
'depth' => 2,
55+
'container' => 'div',
56+
'container_class' => 'collapse navbar-collapse',
57+
'container_id' => 'bs-example-navbar-collapse-1',
58+
'menu_class' => 'nav navbar-nav',
59+
'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
60+
'walker' => new WP_Bootstrap_Navwalker(),
61+
) );
6662
```
6763

6864
Your menu will now be formatted with the correct syntax and classes to implement Bootstrap dropdown navigation.
6965

70-
You will also want to declare your new menu in your `functions.php` file.
66+
You will also want to declare your new menu in your `functions.php` file if one is not already defined.
7167

7268
```php
69+
<?php
7370
register_nav_menus( array(
74-
'primary' => __( 'Primary Menu', 'THEMENAME' ),
71+
'primary' => __( 'Primary Menu', 'THEMENAME' ),
7572
) );
7673
```
7774

7875
Typically the menu is wrapped with additional markup, here is an example of a ` navbar-fixed-top` menu that collapse for responsive navigation.
7976

8077
```php
8178
<nav class="navbar navbar-default" role="navigation">
82-
<div class="container-fluid">
83-
<!-- Brand and toggle get grouped for better mobile display -->
84-
<div class="navbar-header">
85-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
86-
<span class="sr-only">Toggle navigation</span>
87-
<span class="icon-bar"></span>
88-
<span class="icon-bar"></span>
89-
<span class="icon-bar"></span>
90-
</button>
91-
<a class="navbar-brand" href="<?php echo home_url(); ?>">
92-
<?php bloginfo('name'); ?>
93-
</a>
94-
</div>
95-
79+
<div class="container-fluid">
80+
<!-- Brand and toggle get grouped for better mobile display -->
81+
<div class="navbar-header">
82+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
83+
<span class="sr-only">Toggle navigation</span>
84+
<span class="icon-bar"></span>
85+
<span class="icon-bar"></span>
86+
<span class="icon-bar"></span>
87+
</button>
88+
<a class="navbar-brand" href="<?php echo home_url(); ?>">
89+
<?php bloginfo('name'); ?>
90+
</a>
91+
</div>
9692
<?php
97-
wp_nav_menu( array(
98-
'menu' => 'primary',
99-
'theme_location' => 'primary',
100-
'depth' => 2,
101-
'container' => 'div',
102-
'container_class' => 'collapse navbar-collapse',
103-
'container_id' => 'bs-example-navbar-collapse-1',
104-
'menu_class' => 'nav navbar-nav',
105-
'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
106-
'walker' => new WP_Bootstrap_Navwalker())
107-
);
93+
wp_nav_menu( array(
94+
'theme_location' => 'primary',
95+
'depth' => 2,
96+
'container' => 'div',
97+
'container_class' => 'collapse navbar-collapse',
98+
'container_id' => 'bs-example-navbar-collapse-1',
99+
'menu_class' => 'nav navbar-nav',
100+
'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
101+
'walker' => new WP_Bootstrap_Navwalker())
102+
);
108103
?>
109104
</div>
110105
</nav>
@@ -117,13 +112,14 @@ Review options in the Bootstrap docs for more information on [nav classes](https
117112

118113
### Displaying the Menu
119114

120-
To display the menu you must associate your menu with your theme location. You can do this by selecting your theme location in the *Theme Locations* list wile editing a menu in the WordPress menu manager.
115+
To display the menu you must associate your menu with your theme location. You can do this by selecting your theme location in the *Theme Locations* list while editing a menu in the WordPress menu manager.
121116

122117
### Making this Walker the Default Walker for Nav Manus
123118

124119
There has been some interest in making this walker the default walker for all menus. That could result in some unexpected situations but it can be achieved by adding this function to your functions.php file.
125120

126121
```php
122+
<?php
127123
function prefix_modify_nav_menu_args( $args ) {
128124
return array_merge( $args, array(
129125
'walker' => WP_Bootstrap_Navwalker(),
@@ -135,24 +131,24 @@ Simply updating the walker may not be enough to get menus working right, you may
135131

136132
### Extras
137133

138-
This script included the ability to add Bootstrap dividers, dropdown headers, glyphicons and disables links to your menus through the WordPress menu UI.
134+
This script included the ability to add Bootstrap dividers, dropdown headers, glyphicons and disabled links to your menus through the WordPress menu UI.
139135

140-
### Dividers
136+
#### Dividers
141137

142138
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.
143139

144-
### Glyphicons
140+
#### Glyphicons
145141

146142
To add an Icon to your link simple place the Glyphicon class name in the links **Title Attribute** field and the class will do the rest. IE `glyphicon-bullhorn`
147143

148-
### Dropdown Headers
144+
#### Dropdown Headers
149145

150146
Adding a dropdown header is very similar, add a new link with a **URL** of `#` and a **Title Attribute** of `dropdown-header` (it matches the Bootstrap CSS class so it's easy to remember). set the **Navigation Label** to your header text and the class will do the rest.
151147

152-
### Disabled Links
148+
#### Disabled Links
153149

154150
To set a disabled link simply set the **Title Attribute** to `disabled` and the class will do the rest.
155151

156-
### Changelog
152+
## Changelog
157153

158154
Please see the [Changelog](https://github.com/wp-bootstrap/wp-bootstrap-navwalker/blob/master/CHANGELOG.md).

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020
"composer/installers": "~1.0"
2121
},
2222
"require-dev": {
23-
"stevegrunwell/wp-enforcer": "^0.4.1"
23+
"stevegrunwell/wp-enforcer": "^0.5.0"
2424
},
2525
"archive": {
2626
"exclude": ["/.*", "/composer.lock"]
2727
},
2828
"scripts": {
2929
"post-install-cmd": [
30-
"wp-enforcer"
30+
"wp-enforcer --ruleset=phpcs.ruleset.xml"
3131
],
3232
"post-update-cmd": [
33-
"wp-enforcer"
33+
"wp-enforcer --ruleset=phpcs.ruleset.xml"
3434
]
3535
}
3636
}

0 commit comments

Comments
 (0)