Add Command
130 |Add installed plugins and themes to composer.json
131 |132 |134 |Note Some commands will generate a composer.json file if one does not currently exist
133 |
add
135 |Add all plugins and themes to the composer.json file
136 |137 |
wp composer add
138 | 139 |
Example
140 |Let's say that your site has the themes twentyeleven, and twentysixteeen installed. It also has the plugins bbpress, and buddypress installed.
141 |142 |
# Add all installed plugins and themes as dependencies to a composer.json file
143 | wp composer add --file=web/assets
144 | 145 |
Result
146 |A composer.json file will be generated and saved to web/assets/composer.json with twentysixteen added as a dependency and twentyfourteen added as a dev dependency
147 |{
148 | "name": "wp-composer-dependencies",
149 | "description": "Theme and plugin dependencies for the site http://example.com",
150 | "repositories": [
151 | {
152 | "type": "composer",
153 | "url": "https://wpackagist.org"
154 | }
155 | ],
156 | "require": {
157 | "wpackagist-theme/twentysixteen": "*",
158 | "wpackagist-theme/twentyeleven": "*",
159 | "wpackagist-plugin/bbpress": "*",
160 | "wpackagist-plugin/buddypress": "*"
161 | },
162 | "extra": {
163 | "installer-paths": {
164 | "wp-content/themes/{$name}": [
165 | "type:wordpress-theme"
166 | ],
167 | "wp-content/plugins/{$name}": [
168 | "type:wordpress-plugin"
169 | ],
170 | "wp-content/mu-plugins/{$name}": [
171 | "type:wordpress-muplugin"
172 | ]
173 | }
174 | }
175 | }
176 | Options
177 |[--file]
178 |Path to save the composer.json file
179 |[--latest]
180 |Always use the latest version from whatever repo the theme is coming from. default.
181 |182 |184 |Note Unlike plugins, themes on wordpress.org don't have specific versions (e.g. v1.0, v2.0, etc...), so the latest version of a theme will always be downloaded
183 |
[--installer-paths] OR [--ip]
185 |Set the WordPress plugins and themes installer path
186 |[--dev]
187 |Add theme as a dev requirement in composer.json
188 |