Skip to content

Commit c3e3dc4

Browse files
Copilotswissspidy
andcommitted
Add wp_style_add_data() for RTL support in scaffold child-theme
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent ec6320a commit c3e3dc4

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎features/scaffold.feature‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ Feature: WordPress code scaffolding
99
When I run `wp scaffold child-theme zombieland --parent_theme=umbrella --theme_name=Zombieland --author=Tallahassee --author_uri=https://wp-cli.org --theme_uri=http://www.zombieland.com`
1010
Then the {THEME_DIR}/zombieland/style.css file should exist
1111
And the {THEME_DIR}/zombieland/functions.php file should exist
12+
And the {THEME_DIR}/zombieland/functions.php file should contain:
13+
"""
14+
wp_style_add_data( 'umbrella-style', 'rtl', 'replace' );
15+
"""
16+
And the {THEME_DIR}/zombieland/functions.php file should contain:
17+
"""
18+
wp_style_add_data( 'zombieland-style', 'rtl', 'replace' );
19+
"""
1220
And STDOUT should be:
1321
"""
1422
Success: Created '{THEME_DIR}/zombieland'.

‎templates/child_theme_functions.mustache‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ add_action( 'wp_enqueue_scripts', '{{prefix_safe}}_parent_theme_enqueue_styles'
1414
*/
1515
function {{prefix_safe}}_parent_theme_enqueue_styles() {
1616
wp_enqueue_style( '{{parent_theme}}-style', get_template_directory_uri() . '/style.css', array(), '0.1.0' );
17+
wp_style_add_data( '{{parent_theme}}-style', 'rtl', 'replace' );
1718
wp_enqueue_style(
1819
'{{slug}}-style',
1920
get_stylesheet_directory_uri() . '/style.css',
2021
array( '{{parent_theme}}-style' ),
2122
'0.1.0'
2223
);
24+
wp_style_add_data( '{{slug}}-style', 'rtl', 'replace' );
2325
}

0 commit comments

Comments
 (0)