diggy / polylang-cli

WP-CLI community package of Polylang commands
https://github.com/diggy/polylang-cli
MIT License
34 stars 19 forks source link

`pll menu create` command, tests, docs #48

Closed diggy closed 7 years ago

diggy commented 7 years ago

Create a new menu for each language, AND assign it to a location.

$ wp pll menu create "Primary Menu" primary
Success: Assigned location to menu.
Success: Assigned location to menu.
Success: Assigned location to menu.

$ wp pll menu create "Secondary Menu" secondary --porcelain
21 22 23
gbouteiller commented 7 years ago

Great job!! As I'm new to WP-CLI, I didn't know about runcommand and my code was failing with wp menu location assign main location___language. So thank you, as I understand now how to force wp-cli to do what I want :)

gbouteiller commented 7 years ago

Hmm, a little question though, how can I know with the result obtained with porcelain which id matches which language? ( I'm using all the commands with Ansible to automate tasks )

diggy commented 7 years ago

@gbouteiller I'm afraid you'd have to parse the output of wp theme mod get nav_menu_locations:

+--------------------+-------+
| key                | value |
+--------------------+-------+
| nav_menu_locations | =>    |
|     primary        | 53    |
|     primary___de   | 54    |
|     social         | 55    |
|     social___de    | 56    |
+--------------------+-------+