Contents
WP-CLI - Plugixa Image Map
wp plugixa-image-map <command>
| Command | Does |
|---|---|
list |
Lists maps with their id, title, status and hotspot count. |
export <id> |
Exports a map as a file. |
import <file> |
Imports a map from a file, as a draft. |
import-imp |
Imports maps made with Image Map Pro. Each image becomes its own draft. |
import-csv <file> PRO |
Makes a draft map from a spreadsheet of hotspots. |
Commands run as a person
Every command needs --user=<login> and runs with that person’s capabilities.
An import from the command line goes through the same cleaning as one from the
screen, and a user who may not export maps cannot export them here either.
wp plugixa-image-map list --user=admin
Without --user a command stops with a message asking for one.
Options
list
| Option | Meaning |
|---|---|
--status=<status> |
Only maps with this status: draft or published. |
--format=<format> |
table (the default), json, csv or ids. ids prints the ids on one line, separated by spaces. |
Needs the view permission.
export
| Option | Meaning |
|---|---|
<id> |
The map’s id. |
--file=<path> |
Where to write the file. Without it, the export is printed. |
Needs the export permission.
import
| Option | Meaning |
|---|---|
<file> |
The file to read. |
--porcelain |
Print only the new map’s id, for use in scripts. |
Needs the import and create permissions. If the picture is not in the media library, or something in the file had to be adjusted, a warning says so.
import-imp
Give exactly one of these.
| Option | Meaning |
|---|---|
<file> |
A file holding the text that Image Map Pro’s Export shows. |
--source=<id> |
The id of a map Image Map Pro stored on this site. |
--all |
Every map Image Map Pro stored on this site. |
--list |
List the maps Image Map Pro stored on this site, and import nothing. |
Needs the import and create permissions.
import-csv PRO
| Option | Meaning |
|---|---|
<file> |
The CSV file to read, 1 MB at most. |
--image=<id> |
Required. The attachment id of the picture. |
--title=<title> |
The new map’s title. |
--porcelain |
Print only the new map’s id. |
Needs the import and create permissions. The columns are described in Spreadsheet import.
Examples
Export one map to a file:
wp plugixa-image-map export 12 --file=ground-floor.json --user=admin
Without --file, the export is printed, so it can be piped.
Import it on another site:
wp plugixa-image-map import ground-floor.json --user=admin
Import and keep the new id in a shell variable:
ID=$(wp plugixa-image-map import ground-floor.json --porcelain --user=admin)
List the ids of published maps:
wp plugixa-image-map list --status=published --format=ids --user=admin
See which Image Map Pro maps are on this site, then bring over every one:
wp plugixa-image-map import-imp --list --user=admin
wp plugixa-image-map import-imp --all --user=admin
Make a map from a spreadsheet PRO:
wp plugixa-image-map import-csv stands.csv --image=42 --title="Hall A" --user=admin
Moving a map between sites
- On the old site:
export. - Copy the picture to the new site’s media library, keeping its file name.
- On the new site:
import. The map arrives as a draft and finds the picture by name. - Check it, then publish.