Skip to content

Commit

Permalink
Updated Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
LebCit committed Sep 11, 2019
1 parent 933f0a0 commit 6b216db
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,42 @@ To display the menu, you'll have to assign a menu in your backend ( or with the
to the 'description' of the menu 'theme_location' (see the first note above and the image bellow).
Go to *Dashboard* > *Appearance* > *Menus* > *Manage Locations (tab)*
![alt text](menus.png "Logo Title Text 1")

## Customizer Editing Menu

### Important if you want to manage menus from the Customizer !

When you edit a menu from the Customizer by changing items order or adding/removing items,
a partial refresh is made within the Customizer preview on the menu container,
then the menu is displayed according to your modifications.

Since a partial refresh is made on the menu container, it's structure will change,
and **bsWalker** should also be reloaded to apply **Navbar** styles on the new structure,
otherwise, the menu will loose Navbar styles and it will not have the same look as on frontend.

To take care of this issue, **bsWalker** should be fully reloaded **after** the partial refresh is done.
To accomplish this task, another lightweight js file is needed.
In the **functions.php** file of you theme - `/wp-content/your-theme/functions.php` - add the following code:
```php
function bswalker_customize_preview_js() {
wp_enqueue_script( 'bswalker-customizer', get_theme_file_uri( '/js/bsWalker-customizer.min.js' ), array( 'jquery', 'customize-preview' ), filemtime( get_theme_file_path( '/js/bsWalker-customizer.min.js' ) ), true );
}
add_action( 'customize_preview_init', 'bswalker_customize_preview_js' );
```
Put **bsWalker-customizer.min.js** file in the same **js** folder as **bsWalker.min.js**

### Very Important !

You absolutely have to change `"menu-1"` in **bsWalker-customizer.min.js**
to your `'theme_location'` string (e.g. "primary").

## Changelog

### v1.0 - September 12 2019

* Added bsWalker.js
* Added bsWalker-customizer.js
* Added screenshot
* Updated Readme.md
* **bsWalker.min.js** 1.22KiB = 1.24928 KB
* **bsWalker-customizer.min.js** 1.48 KiB =1.51552 KB

0 comments on commit 6b216db

Please sign in to comment.