Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions features/menu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ Feature: Manage WordPress menus
0
"""

When I run `wp menu create "First Menu"`
And I run `wp menu list --format=ids`
Then STDOUT should be:
"""
5
"""

Scenario: Assign / remove location from a menu

When I run `wp theme install p2 --activate`
Expand Down
11 changes: 10 additions & 1 deletion php/commands/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,17 @@ public function list_( $_, $assoc_args ) {
}

$formatter = $this->get_formatter( $assoc_args );
$formatter->display_items( $menus );

if ( 'ids' == $formatter->format ) {
$ids = array_map(
function($o) {
return $o->term_id;
}, $menus
);
$formatter->display_items( $ids );
} else {
$formatter->display_items( $menus );
}
}

protected function get_formatter( &$assoc_args ) {
Expand Down