WordPress как на ладони
Дешевый WordPress пакет для разработки Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru

wp scaffold

Генерирует код для типов записей, таксономий, плагинов, дочерних тем и т.д.

Список команд Описание
Генерирует PHP код для регистрации пользовательского типа записи.
Генерирует PHP код для регистрации пользовательской таксономии.
Генерирует PHP, JS и CSS код для регистрации блока Гутенберга, для плагина или темы.
Создает начальный код для темы на основе темы _s.
Создает дочернюю тему на основе существующей темы.
Генерирует стартовый код для плагина.
Создает файлы, необходимые для выполнения тестов PHPUnit в плагине.
Создает файлы, необходимые для выполнения тестов PHPUnit в тему.

Примеры

# Generate a new plugin with unit tests
$ wp scaffold plugin sample-plugin
Success: Created plugin files.
Success: Created test files.

# Generate theme based on _s
$ wp scaffold _s sample-theme --theme_name="Sample Theme" --author="John Doe"
Success: Created theme 'Sample Theme'.

# Generate code for post type registration in given theme
$ wp scaffold post-type movie --label=Movie --theme=simple-life
Success: Created /var/www/example.com/public_html/wp-content/themes/simple-life/post-types/movie.php

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


wp scaffold post-type

Генерирует PHP код для регистрации пользовательского типа записи.

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

wp scaffold post-type {slug} [--label={label}] [--textdomain={textdomain}] [--dashicon={dashicon}] [--theme] [--plugin={plugin}] [--raw] [--force]

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

{slug}
The internal name of the post type.
[--label={label}]
The text used to translate the update messages.
[--textdomain={textdomain}]
The textdomain to use for the labels.
[--dashicon={dashicon}]
The dashicon to use in the menu.
[--theme]
Create a file in the active theme directory, instead of sending to STDOUT. Specify a theme with --theme=<theme> to have the file placed in that theme.
[--plugin={plugin}]
Create a file in the given plugin's directory, instead of sending to STDOUT.
[--raw]
Just generate the register_post_type() call and nothing else.
[--force]
Overwrite files that already exist.

Примеры

# Generate a 'movie' post type for the 'simple-life' theme
$ wp scaffold post-type movie --label=Movie --theme=simple-life
Success: Created '/var/www/example.com/public_html/wp-content/themes/simple-life/post-types/movie.php'.
меню

wp scaffold taxonomy

Генерирует PHP код для регистрации пользовательской таксономии.

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

wp scaffold taxonomy {slug} [--post_types={post-types}] [--label={label}] [--textdomain={textdomain}] [--theme] [--plugin={plugin}] [--raw] [--force]

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

{slug}
The internal name of the taxonomy.
[--post_types={post-types}]
Post types to register for use with the taxonomy.
[--label={label}]
The text used to translate the update messages.
[--textdomain={textdomain}]
The textdomain to use for the labels.
[--theme]
Create a file in the active theme directory, instead of sending to STDOUT. Specify a theme with --theme=<theme> to have the file placed in that theme.
[--plugin={plugin}]
Create a file in the given plugin's directory, instead of sending to STDOUT.
[--raw]
Just generate the register_taxonomy() call and nothing else.
[--force]
Overwrite files that already exist.

Примеры

# Generate PHP code for registering a custom taxonomy and save in a file
$ wp scaffold taxonomy venue --post_types=event,presentation > taxonomy.php
меню

wp scaffold block

Генерирует PHP, JS и CSS код для регистрации блока Гутенберга, для плагина или темы.

Blocks are the fundamental element of the Gutenberg editor. They are the primary way in which plugins and themes can register their own functionality and extend the capabilities of the editor.

Visit the Gutenberg handbook to learn more about Block API.

When you scaffold a block you must use either the theme or plugin option. The latter is recommended.

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

wp scaffold block {slug} [--title={title}] [--dashicon={dashicon}] [--category={category}] [--theme] [--plugin={plugin}] [--force]

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

{slug}
The internal name of the block.
[--title={title}]
The display title for your block.
[--dashicon={dashicon}]
The dashicon to make it easier to identify your block.
[--category={category}]

The category name to help users browse and discover your block.
По умолчанию: widgets
Может быть:

  • common
  • embed
  • formatting
  • layout
  • widgets
[--theme]
Create files in the active theme directory. Specify a theme with --theme=<theme> to have the file placed in that theme.
[--plugin={plugin}]
Create files in the given plugin's directory.
[--force]
Overwrite files that already exist.

Примеры

# Generate a 'movie' block for the 'movies' plugin
$ wp scaffold block movie --title="Movie block" --plugin=movies
Success: Created block 'Movie block'.
# Generate a 'movie' block for the 'simple-life' theme
$ wp scaffold block movie --title="Movie block" --theme=simple-life
 Success: Created block 'Movie block'.
# Create a new plugin and add two blocks
# Create plugin called books
$ wp scaffold plugin books
# Add a block called book to plugin books
$ wp scaffold block book --title="Book" --plugin=books
# Add a second block to plugin called books.
$ wp scaffold block books --title="Book List" --plugin=books
меню

wp scaffold -s

Создает начальный код для темы на основе темы _s.

See the Underscores website for more details.

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

wp scaffold -s {slug} [--activate] [--enable-network] [--theme_name={title}] [--author={full-name}] [--author_uri={uri}] [--sassify] [--woocommerce] [--force]

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

{slug}
The slug for the new theme, used for prefixing functions.
[--activate]
Activate the newly downloaded theme.
[--enable-network]
Enable the newly downloaded theme for the entire network.
[--theme_name={title}]
What to put in the 'Theme Name:' header in 'style.css'.
[--author={full-name}]
What to put in the 'Author:' header in 'style.css'.
[--author_uri={uri}]
What to put in the 'Author URI:' header in 'style.css'.
[--sassify]
Include stylesheets as SASS.
[--woocommerce]
Include WooCommerce boilerplate files.
[--force]
Overwrite files that already exist.

Примеры

# Generate a theme with name "Sample Theme" and author "John Doe"
$ wp scaffold _s sample-theme --theme_name="Sample Theme" --author="John Doe"
Success: Created theme 'Sample Theme'.
меню

wp scaffold child-theme

Создает дочернюю тему на основе существующей темы.

Creates a child theme folder with functions.php and style.css files.

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

wp scaffold child-theme {slug} --parent_theme={slug} [--theme_name={title}] [--author={full-name}] [--author_uri={uri}] [--theme_uri={uri}] [--activate] [--enable-network] [--force]

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

{slug}
The slug for the new child theme.
--parent_theme={slug}
What to put in the 'Template:' header in 'style.css'.
[--theme_name={title}]
What to put in the 'Theme Name:' header in 'style.css'.
[--author={full-name}]
What to put in the 'Author:' header in 'style.css'.
[--author_uri={uri}]
What to put in the 'Author URI:' header in 'style.css'.
[--theme_uri={uri}]
What to put in the 'Theme URI:' header in 'style.css'.
[--activate]
Activate the newly created child theme.
[--enable-network]
Enable the newly created child theme for the entire network.
[--force]
Overwrite files that already exist.

Примеры

# Generate a 'sample-theme' child theme based on TwentySixteen
$ wp scaffold child-theme sample-theme --parent_theme=twentysixteen
Success: Created '/var/www/example.com/public_html/wp-content/themes/sample-theme'.
меню

wp scaffold plugin

Генерирует стартовый код для плагина.

The following files are always generated:

  • plugin-slug.php is the main PHP plugin file.
  • readme.txt is the readme file for the plugin.
  • package.json needed by NPM holds various metadata relevant to the project. Packages: grunt, grunt-wp-i18n and grunt-wp-readme-to-markdown.
  • Gruntfile.js is the JS file containing Grunt tasks. Tasks: i18n containing addtextdomain and makepot, readme containing wp_readme_to_markdown.
  • .editorconfig is the configuration file for Editor.
  • .gitignore tells which files (or patterns) git should ignore.
  • .distignore tells which files and folders should be ignored in distribution.

The following files are also included unless the --skip-tests is used:

  • phpunit.xml.dist is the configuration file for PHPUnit.
  • .travis.yml is the configuration file for Travis CI. Use --ci=<provider> to select a different service.
  • bin/install-wp-tests.sh configures the WordPress test suite and a test database.
  • tests/bootstrap.php is the file that makes the current plugin active when running the test suite.
  • tests/test-sample.php is a sample file containing test cases.
  • .phpcs.xml.dist is a collection of PHP_CodeSniffer rules.

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

wp scaffold plugin {slug} [--dir={dirname}] [--plugin_name={title}] [--plugin_description={description}] [--plugin_author={author}] [--plugin_author_uri={url}] [--plugin_uri={url}] [--skip-tests] [--ci={provider}] [--activate] [--activate-network] [--force]

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

{slug}
The internal name of the plugin.
[--dir={dirname}]
Put the new plugin in some arbitrary directory path. Plugin directory will be path plus supplied slug.
[--plugin_name={title}]
What to put in the 'Plugin Name:' header.
[--plugin_description={description}]
What to put in the 'Description:' header.
[--plugin_author={author}]
What to put in the 'Author:' header.
[--plugin_author_uri={url}]
What to put in the 'Author URI:' header.
[--plugin_uri={url}]
What to put in the 'Plugin URI:' header.
[--skip-tests]
Don't generate files for unit testing.
[--ci={provider}]

Choose a configuration file for a continuous integration provider.
По умолчанию: travis
Может быть:

  • travis
  • circle
  • gitlab
[--activate]
Activate the newly generated plugin.
[--activate-network]
Network activate the newly generated plugin.
[--force]
Overwrite files that already exist.

Примеры

$ wp scaffold plugin sample-plugin
Success: Created plugin files.
Success: Created test files.
меню

wp scaffold plugin-tests

Создает файлы, необходимые для выполнения тестов PHPUnit в плагине.

The following files are generated by default:

  • phpunit.xml.dist is the configuration file for PHPUnit.
  • .travis.yml is the configuration file for Travis CI. Use --ci=<provider> to select a different service.
  • bin/install-wp-tests.sh configures the WordPress test suite and a test database.
  • tests/bootstrap.php is the file that makes the current plugin active when running the test suite.
  • tests/test-sample.php is a sample file containing the actual tests.
  • .phpcs.xml.dist is a collection of PHP_CodeSniffer rules.

Learn more from the plugin unit tests documentation.

Окружающая среда

The tests/bootstrap.php file looks for the WP_TESTS_DIR environment variable.

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

wp scaffold plugin-tests [{plugin}] [--dir={dirname}] [--ci={provider}] [--force]

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

[{plugin}]
The name of the plugin to generate test files for.
[--dir={dirname}]
Generate test files for a non-standard plugin path. If no plugin slug is specified, the directory name is used.
[--ci={provider}]

Choose a configuration file for a continuous integration provider.
По умолчанию: travis
Может быть:

  • travis
  • circle
  • gitlab
  • bitbucket
[--force]
Overwrite files that already exist.

Примеры

# Generate unit test files for plugin 'sample-plugin'.
$ wp scaffold plugin-tests sample-plugin
Success: Created test files.
меню

wp scaffold theme-tests

Создает файлы, необходимые для выполнения тестов PHPUnit в тему.

The following files are generated by default:

  • phpunit.xml.dist is the configuration file for PHPUnit.
  • .travis.yml is the configuration file for Travis CI. Use --ci=<provider> to select a different service.
  • bin/install-wp-tests.sh configures the WordPress test suite and a test database.
  • tests/bootstrap.php is the file that makes the current theme active when running the test suite.
  • tests/test-sample.php is a sample file containing the actual tests.
  • .phpcs.xml.dist is a collection of PHP_CodeSniffer rules.

Learn more from the plugin unit tests documentation.

Окружающая среда

The tests/bootstrap.php file looks for the WP_TESTS_DIR environment variable.

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

wp scaffold theme-tests [{theme}] [--dir={dirname}] [--ci={provider}] [--force]

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

[{theme}]
The name of the theme to generate test files for.
[--dir={dirname}]
Generate test files for a non-standard theme path. If no theme slug is specified, the directory name is used.
[--ci={provider}]

Choose a configuration file for a continuous integration provider.
По умолчанию: travis
Может быть:

  • travis
  • circle
  • gitlab
  • bitbucket
[--force]
Overwrite files that already exist.

Примеры

# Generate unit test files for theme 'twentysixteenchild'.
$ wp scaffold theme-tests twentysixteenchild
Success: Created test files.
Комментариев нет
    Здравствуйте, !     Войти . Зарегистрироваться