wp-cli / scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.
MIT License
165 stars 87 forks source link

Scaffold Block Doesn't Support Child Theme #241

Closed zzap closed 5 years ago

zzap commented 5 years ago

Bug Report

Current behavior

When scaffolded for child theme, block's files are pointing to parent theme with get_template_directory() and get_template_directory_uri() functions.

Replicate

Expected outcome

After including block's php file in functions.php, I expect to have newly created block available on edit post/page screen, without errors.

Let us know what environment you are running this on

OS:     Linux 5.0.0-35-generic #38-Ubuntu SMP Sat Nov 9 17:51:58 UTC 2019 x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php7.2
PHP version:    7.2.24-0ubuntu0.19.04.1
php.ini used:   /etc/php/7.2/cli/php.ini
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /home/milana
WP-CLI packages dir:    /home/milana/.wp-cli/packages/
WP-CLI global config:   /home/milana/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version: 2.4.0

Provide a possible solution

Replacing get_template_directory() and get_template_directory_uri() functions with get_stylesheet_directory() and get_stylesheet_directory_uri() respectively will work for both, standalone or child theme.

zzap commented 5 years ago

Duplicate of #232.