Dereckson
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] WP-CLI supportHow 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.jsonThe 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
makeorgrunt, 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.
Forum: Plugins
In reply to: [Polylang] WP-CLI supportOh a little demo of what we can do with a command line support:
$ wp polylang language info fr Code: fr Locale fr_FR Name: Français RTL: no Installed: yes $ wp polylang get post 1 en 1 $ wp polylang get post 1 fr 7 $ wp polylang languages fr — Français [DEFAULT] en — English $ wp polylang language add nl Success: language added. $ wp polylang languages fr — Français [DEFAULT] en — English nl — Nederlands $ wp polylang language del xx Error: xx isn't a valid language code. $ wp polylang language del eo Warning: This language isn't installed. $ wp polylang home nl http://wordpresslanguagestack.threyscend.drake/nl