Unverified Commit 6748d4bf authored by Peter J. Herrel's avatar Peter J. Herrel
Browse files

add 'wp pll term list' subcommand

closes #102
parent a2deb30e
......@@ -155,6 +155,86 @@ class TermCommand extends BaseCommand {
);
}
/**
* Get a list of taxonomy terms for a language.
*
* ## OPTIONS
*
* <taxonomy>
* : List terms of one or more taxonomies. Required.
*
* <language-code>
* : The language code (slug) to get the taxonomy terms for. Required.
*
* [--<field>=<value>]
* : Filter by one or more fields (see get_terms() $args parameter for a list of fields).
*
* [--field=<field>]
* : Prints the value of a single field for each term.
*
* [--fields=<fields>]
* : Limit the output to specific object fields.
*
* [--format=<format>]
* : Render output in a particular format.
* ---
* default: table
* options:
* - table
* - csv
* - ids
* - json
* - count
* - yaml
* ---
*
* ## AVAILABLE FIELDS
*
* These fields will be displayed by default for each term:
*
* * term_id
* * term_taxonomy_id
* * name
* * slug
* * description
* * parent
* * count
*
* These fields are optionally available:
*
* * url
*
* ## EXAMPLES
*
* # List post categories
* $ wp pll term list color nl --format=csv
* term_id,term_taxonomy_id,name,slug,description,parent,count
* 2,2,Rood,rood,,0,1
* 3,3,Blauw,blauw,,0,1
*
* # List post tags
* $ wp pll term list post_tag en --fields=name,slug
* +-----------+-------------+
* | name | slug |
* +-----------+-------------+
* | Articles | articles |
* | aside | aside |
* +-----------+-------------+
*
* @subcommand list
*/
public function list_( $args, $assoc_args )
{
list ( $taxonomy, $language ) = $args;
new \PLL_Frontend_Filters( $this->pll );
$this->cli->command(
array( 'term', 'list', $taxonomy ),
array_merge( array( 'lang' => $language ), $assoc_args )
);
}
/**
* Generate some taxonomy terms and their translations.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment