Answer a question

I am setting up a WordPress site with BedRock and was thinking if there is a way to "require" the ACF plugin in my composer.

So the plan is to have clean and simple repo where you do a git pull and composer install and then everything gets installed (including plugins)

But I don't find any documentation on the ACF site on how to do this.

Is this even possible? lol

I found this package but it's for ACF Pro and I just need the free version.

https://github.com/PhilippBaschke/acf-pro-installer

If anyone has any experience with BedRock and can help me out that would be greatly appreciated :)

Many thanks in advance!

Answers

If you add the wpackagist repository to Composer's "repositories", you can then require the ACF free version.

In Bedrock's composer.json add the wp-packagist repo:

"repositories": [
    {
        "type": "composer",
        "url": "https://wpackagist.org"
    }
],
...

Then in the same file, require the plugin:

"require": {
    "php": ">=5.6",
    "composer/installers": "~1.0.12",
    "vlucas/phpdotenv": "^2.0.1",
    "johnpbloch/wordpress": "4.7.2",
    "oscarotero/env": "^1.0",
    "roots/wp-password-bcrypt": "1.0.0",
    "roots/soil": "3.7.1",
    "wpackagist-plugin/advanced-custom-fields" : "4.1.*"
},
...

Run composer update and it should fetch the plugin.

Logo

React社区为您提供最前沿的新闻资讯和知识内容

更多推荐