wp theme

Управляет темами, включая установки, активации и обновления.

See the WordPress Theme Handbook developer resource for more information on themes.

Список команд Описание
wp theme status Показывает состояние одной или всех тем.
wp theme search Поиск по каталогу тем WordPress.org.
wp theme activate Активирует тему.
wp theme enable Включает тему на мультисайт установке WordPress.
wp theme disable Отключает тему на мультисайт установке WordPress.
wp theme path Возвращает путь к теме или каталогу темы.
wp theme install Устанавливает одну или несколько тем.
wp theme get Получает сведения о теме.
wp theme update Обновление одной или нескольких тем.
wp theme is-installed Проверяет, установлена ли данная тема.
wp theme is-active Проверяет, активна ли данная тема.
wp theme delete Удаляет одну или несколько тем.
wp theme list Возвращает список тем.
wp theme mod get Получает один или несколько опций темы.
wp theme mod list Получает список опций темы.
wp theme mod remove Удаляет один или несколько опций темы.
wp theme mod set Задает значение опции темы.

Примеры

# Install the latest version of a theme from wordpress.org and activate
$ wp theme install twentysixteen --activate
Installing Twenty Sixteen (1.2)
Downloading install package from https://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
Unpacking the package...
Installing the theme...
Theme installed successfully.
Activating 'twentysixteen'...
Success: Switched to 'Twenty Sixteen' theme.

# Get details of an installed theme
$ wp theme get twentysixteen --fields=name,title,version
+---------+----------------+
| Field   | Value          |
+---------+----------------+
| name    | Twenty Sixteen |
| title   | Twenty Sixteen |
| version | 1.2            |
+---------+----------------+

# Get status of theme
$ wp theme status twentysixteen
Theme twentysixteen details:
		Name: Twenty Sixteen
		Status: Active
		Version: 1.2
		Author: the WordPress team

Исходный код команд


wp theme status

Показывает состояние одной или всех тем.

Использование

wp theme status [{theme}]

Можно указать Глобальные параметры и следующие:

[{theme}]
A particular theme to show the status for.

Примеры

$ wp theme status twentysixteen
Theme twentysixteen details:
		Name: Twenty Sixteen
		Status: Inactive
		Version: 1.2
		Author: the WordPress team

Поиск по каталогу тем WordPress.org.

Displays themes in the WordPress.org theme directory matching a given search query.

Использование

wp theme search {search} [--per-page={per-page}] [--field={field}] [--fields={fields}] [--format={format}]

Можно указать Глобальные параметры и следующие:

{search}
The string to search for.
[--per-page={per-page}]
Optional number of results to display. Defaults to 10.
[--field={field}]
Prints the value of a single field for each theme.
[--fields={fields}]

Ask for specific fields from the API. Defaults to name,slug,author,rating. Acceptable values:

name: Theme Name
slug: Theme Slug
version: Current Version Number
author: Theme Author
preview_url: Theme Preview URL
screenshot_url: Theme Screenshot URL
rating: Theme Rating
num_ratings: Number of Theme Ratings
homepage: Theme Author's Homepage
description: Theme Description
url: Theme's URL on wordpress.org

[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • count
  • yaml

Примеры

$ wp theme search photo --per-page=6
Success: Showing 6 of 203 themes.
+----------------------+----------------------+--------+
| name                 | slug                 | rating |
+----------------------+----------------------+--------+
| Photos               | photos               | 100    |
| Infinite Photography | infinite-photography | 100    |
| PhotoBook            | photobook            | 100    |
| BG Photo Frame       | bg-photo-frame       | 0      |
| fPhotography         | fphotography         | 0      |
| Photo Perfect        | photo-perfect        | 98     |
+----------------------+----------------------+--------+

wp theme activate

Активирует тему.

Использование

wp theme activate {theme}

Можно указать Глобальные параметры и следующие:

{theme}
The theme to activate.

Примеры

$ wp theme activate twentysixteen
Success: Switched to 'Twenty Sixteen' theme.

wp theme enable

Включает тему на мультисайт установке WordPress.

Permits theme to be activated from the dashboard of a site on a WordPress multisite install.

Использование

wp theme enable {theme} [--network] [--activate]

Можно указать Глобальные параметры и следующие:

{theme}
The theme to enable.
[--network]
If set, the theme is enabled for the entire network
[--activate]
If set, the theme is activated for the current site. Note that the "network" flag has no influence on this.

Примеры

# Enable theme
$ wp theme enable twentysixteen
Success: Enabled the 'Twenty Sixteen' theme.
# Network enable theme
$ wp theme enable twentysixteen --network
Success: Network enabled the 'Twenty Sixteen' theme.
# Network enable and activate theme for current site
$ wp theme enable twentysixteen --activate
Success: Enabled the 'Twenty Sixteen' theme.
Success: Switched to 'Twenty Sixteen' theme.

wp theme disable

Отключает тему на мультисайт установке WordPress.

Removes ability for a theme to be activated from the dashboard of a site on a WordPress multisite install.

Использование

wp theme disable {theme} [--network]

Можно указать Глобальные параметры и следующие:

{theme}
The theme to disable.
[--network]
If set, the theme is disabled on the network level. Note that individual sites may still have this theme enabled if it was enabled for them independently.

Примеры

# Disable theme
$ wp theme disable twentysixteen
Success: Disabled the 'Twenty Sixteen' theme.
# Disable theme in network level
$ wp theme disable twentysixteen --network
Success: Network disabled the 'Twenty Sixteen' theme.

wp theme path

Возвращает путь к теме или каталогу темы.

Использование

wp theme path [{theme}] [--dir]

Можно указать Глобальные параметры и следующие:

[{theme}]
The theme to get the path to. Path includes "style.css" file. If not set, will return the path to the themes directory.
[--dir]
If set, get the path to the closest parent directory, instead of the theme's "style.css" file.

Примеры

# Get theme path
$ wp theme path
/var/www/example.com/public_html/wp-content/themes
# Change directory to theme path
$ cd $(wp theme path)

wp theme install

Устанавливает одну или несколько тем.

Использование

wp theme install {theme|zip|url}... [--version={version}] [--force] [--activate]

Можно указать Глобальные параметры и следующие:

{theme|zip|url}...
One or more themes to install. Accepts a theme slug, the path to a local zip file, or a URL to a remote zip file.
[--version={version}]
If set, get that particular version from wordpress.org, instead of the stable version.
[--force]
If set, the command will overwrite any installed version of the theme, without prompting for confirmation.
[--activate]
If set, the theme will be activated immediately after install.

Примеры

# Install the latest version from wordpress.org and activate
$ wp theme install twentysixteen --activate
Installing Twenty Sixteen (1.2)
Downloading install package from http://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
Unpacking the package...
Installing the theme...
Theme installed successfully.
Activating 'twentysixteen'...
Success: Switched to 'Twenty Sixteen' theme.
# Install from a local zip file
$ wp theme install ../my-theme.zip
# Install from a remote zip file
$ wp theme install http://s3.amazonaws.com/bucketname/my-theme.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef

wp theme get

Получает сведения о теме.

Использование

wp theme get {theme} [--field={field}] [--fields={fields}] [--format={format}]

Можно указать Глобальные параметры и следующие:

{theme}
The theme to get.
[--field={field}]
Instead of returning the whole theme, returns the value of a single field.
[--fields={fields}]
Limit the output to specific fields. Defaults to all fields.
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • yaml

Примеры

$ wp theme get twentysixteen --fields=name,title,version
+---------+----------------+
| Field   | Value          |
+---------+----------------+
| name    | Twenty Sixteen |
| title   | Twenty Sixteen |
| version | 1.2            |
+---------+----------------+

wp theme update

Обновление одной или нескольких тем.

Использование

wp theme update [{theme}...] [--all] [--exclude={theme-names}] [--format={format}] [--version={version}] [--dry-run]

Можно указать Глобальные параметры и следующие:

[{theme}...]
One or more themes to update.
[--all]
If set, all themes that have updates will be updated.
[--exclude={theme-names}]
Comma separated list of theme names that should be excluded from updating.
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • summary
[--version={version}]
If set, the theme will be updated to the specified version.
[--dry-run]
Preview which themes would be updated.

Примеры

# Update multiple themes
$ wp theme update twentyfifteen twentysixteen
Downloading update from https://downloads.wordpress.org/theme/twentyfifteen.1.5.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
Downloading update from https://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
+---------------+-------------+-------------+---------+
| name          | old_version | new_version | status  |
+---------------+-------------+-------------+---------+
| twentyfifteen | 1.4         | 1.5         | Updated |
| twentysixteen | 1.1         | 1.2         | Updated |
+---------------+-------------+-------------+---------+
Success: Updated 2 of 2 themes.
# Exclude themes updates when bulk updating the themes
$ wp theme update --all --exclude=twentyfifteen
Downloading update from https://downloads.wordpress.org/theme/astra.1.0.5.1.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
Downloading update from https://downloads.wordpress.org/theme/twentyseventeen.1.2.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
+-----------------+----------+---------+----------------+
| name            | status   | version | update_version |
+-----------------+----------+---------+----------------+
| astra           | inactive | 1.0.1   | 1.0.5.1        |
| twentyseventeen | inactive | 1.1     | 1.2            |
+-----------------+----------+---------+----------------+
Success: Updated 2 of 2 themes.
# Update all themes
$ wp theme update --all

wp theme is-installed

Проверяет, установлена ли данная тема.

Returns exit code 0 when installed, 1 when uninstalled.

Использование

wp theme is-installed {theme}

Можно указать Глобальные параметры и следующие:

{theme}
The theme to check.

Примеры

# Check whether theme is installed; exit status 0 if installed, otherwise 1
$ wp theme is-installed hello
$ echo $?
1

wp theme is-active

Проверяет, активна ли данная тема.

Returns exit code 0 when active, 1 when not active.

Использование

wp theme is-active {theme}

Можно указать Глобальные параметры и следующие:

{theme}
The plugin to check.

Примеры

# Check whether theme is Active; exit status 0 if active, otherwise 1
$ wp theme is-active twentyfifteen
$ echo $?
1

wp theme delete

Удаляет одну или несколько тем.

Removes the theme or themes from the filesystem.

Использование

wp theme delete {theme}...

Можно указать Глобальные параметры и следующие:

{theme}...
One or more themes to delete.

Примеры

$ wp theme delete twentytwelve
Deleted 'twentytwelve' theme.
Success: Deleted 1 of 1 themes.

wp theme list

Возвращает список тем.

Использование

wp theme list [--{field}={value}] [--field={field}] [--fields={fields}] [--format={format}]

Можно указать Глобальные параметры и следующие:

[--{field}={value}]
Filter results based on the value of a field.
[--field={field}]
Prints the value of a single field for each theme.
[--fields={fields}]
Limit the output to specific object fields.
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • count
  • yaml

Доступные поля

These fields will be displayed by default for each theme:

  • name
  • status
  • update
  • version

These fields are optionally available:

  • update_version
  • update_package
  • update_id
  • title
  • description

Примеры

# List themes
$ wp theme list --status=inactive --format=csv
name,status,update,version
twentyfourteen,inactive,none,1.7
twentysixteen,inactive,available,1.1

wp theme mod get

Получает один или несколько опций темы.

Использование

wp theme mod get [{mod}...] [--field={field}] [--all] [--format={format}]

Можно указать Глобальные параметры и следующие:

[{mod}...]
One or more mods to get.
[--field={field}]
Returns the value of a single field.
[--all]
List all theme mods
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • json
  • csv
  • yaml

Примеры

# Get all theme mods.
$ wp theme mod get --all
+------------------+---------+
| key              | value   |
+------------------+---------+
| background_color | dd3333  |
| link_color       | #dd9933 |
| main_text_color  | #8224e3 |
+------------------+---------+
# Get single theme mod in JSON format.
$ wp theme mod get background_color --format=json
[{"key":"background_color","value":"dd3333"}]
# Get value of a single theme mod.
$ wp theme mod get background_color --field=value
dd3333
# Get multiple theme mods.
$ wp theme mod get background_color header_textcolor
+------------------+--------+
| key              | value  |
+------------------+--------+
| background_color | dd3333 |
| header_textcolor |        |
+------------------+--------+

wp theme mod list

Получает список опций темы.

Использование

wp theme mod list [--field={field}] [--format={format}]

Можно указать Глобальные параметры и следующие:

[--field={field}]
Returns the value of a single field.
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • json
  • csv
  • yaml

Примеры

# Gets a list of theme mods.
$ wp theme mod list
+------------------+---------+
| key              | value   |
+------------------+---------+
| background_color | dd3333  |
| link_color       | #dd9933 |
| main_text_color  | #8224e3 |
+------------------+---------+

wp theme mod remove

Удаляет один или несколько опций темы.

Использование

wp theme mod remove [{mod}...] [--all]

Можно указать Глобальные параметры и следующие:

[{mod}...]
One or more mods to remove.
[--all]
Remove all theme mods.

Примеры

# Remove all theme mods.
$ wp theme mod remove --all
Success: Theme mods removed.
# Remove single theme mod.
$ wp theme mod remove background_color
Success: 1 mod removed.
# Remove multiple theme mods.
$ wp theme mod remove background_color header_textcolor
Success: 2 mods removed.

wp theme mod set

Задает значение опции темы.

Использование

wp theme mod set {mod} {value}

Можно указать Глобальные параметры и следующие:

{mod}
The name of the theme mod to set or update.
{value}
The new value.

Примеры

# Set theme mod
$ wp theme mod set background_color 000000
Success: Theme mod background_color set to 000000