Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

Dereckson on "[Plugin: Polylang] WP-CLI support"

$
0
0

How to offer a WP-CLI command.

There are three strategies to offer a WP-CLI command:

(1) in WP-CLI itself, for Wordpress core (not usable here so)

(2) in a plug-in

(3) as a WP-CLI community package

For 3, the requirement is to have a repository with Polylang_Command class file, and a JSON Composer file to load it:
https://github.com/dereckson/wp-cli-polylang/blob/master/composer.json

The drawback of a community package is it requires an extra installation. If we include it directly in the plug-in, every Polylang user who have WP-CLI installed has access to the command.

There is a slight advantage for the community package: it's listed on http://wp-cli.org/package-index/.

I don't know the best solution.

The WP-CLI interest in Polylang context.

WP-CLI becomes more and more mainstream. WP-CLI is included in some popular hosting companies like MediaTemple or DreamHost. It's also available on http://vip.wordpress.com/.

It allows to do continuous integration like Puppet/Chef/Ansible VM provisioning, run tests on Jenkins, etc.

For a small project, it allows to deliver to the customer two files: a description file (like a Composer.json) and a task runner file (a plain old Makefile, or something more modern like Grun). Then, writing make or grunt, Wordpress and the plug-ins repo are cloned, installed in the relevant directories. WP-CLI allows at this stage to add some configuration.

For example:

...
wp option add sitetitle "Agentschap agentschappen"
wp polylang language add en
wp polylang language add fr
wp polylang language add nl
...

I found that very interesting to automate stuff.

Features.

There was also this question a couple of months ago. Do you set the language of a post / term using WP-CLI? Or maybe you just setup the website and don't add content.

Yes, we could add this, it's a good idea.

For example, http://wp-cli.org/commands/post/ allows to create a new post and http://wp-cli.org/commands/post-meta/ to set meta options.


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>