Skip to content

Commit 1f6bbc8

Browse files
committed
Update README with info about wp_enqueue_scripts/style
1 parent f2e34e3 commit 1f6bbc8

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Install Wordpress on you localhost (MAMP, LAMP)
7878
`cd` into your theme directory. E.g.:
7979

8080
```bash
81-
cd project/wp-content/themes/[your_theme_folder]
81+
cd project/wp-content/themes/[your_theme_folder_name]
8282
```
8383

8484
#### Step 3 - Clone starter
@@ -102,7 +102,7 @@ Edit `./tasks/config.json` file with following instruction:
102102
}
103103
```
104104

105-
Starting from now all compiled files will land to `themes/[your_theme_folder_folder]/assets`.
105+
Starting from now all compiled files will land to `themes/[your_theme_folder_name_folder]/assets`.
106106

107107
2. Disable the `html` `run` task, since we don’t need to compile HTML in Wordpress:
108108

@@ -124,13 +124,34 @@ Starting from now all compiled files will land to `themes/[your_theme_folder_fol
124124
{
125125
"proxy": {
126126
"target": "http://localhost/[your_project]",
127-
"publicPath" : "http://localhost:3333/[your_project]/wp-content/themes/[your_theme_folder]/assets/js/"
127+
"publicPath" : "http://localhost:3333/[your_project]/wp-content/themes/[your_theme_folder_name]/assets/js/"
128128
}
129129
}
130130
```
131131

132+
4. Double check if you attached assets in `[your_theme_folder_name]/functions.php`:
133+
134+
```php
135+
function enqueue_styles()
136+
{
137+
wp_enqueue_style('custom', get_template_directory_uri() . '/assets/css/bundle.css', [], null);
138+
}
139+
140+
add_action('wp_enqueue_scripts', 'enqueue_styles');
141+
142+
function register_scripts()
143+
{
144+
wp_enqueue_script('custom-js', get_template_directory_uri() . '/assets/js/bundle.js', [], null, true);
145+
}
146+
147+
add_action('wp_enqueue_scripts', 'register_scripts');
148+
```
149+
132150
#### Step 5 - run
133151

152+
In `[your_theme_folder_name]/[your_frontend_folder_name]`
153+
154+
134155
```bash
135156
yarn
136157
yarn start

0 commit comments

Comments
 (0)