Roots Discourse

Problem adding Font Awesome Plugin as a Composer Package

I am using the following steps to add Font Awesome plugin as a composer package: https://github.com/FortAwesome/wordpress-fontawesome

I run the composer require fortawesome/wordpress-fontawesome command, and it correctly adds the package to the “require” list in composer.json. It is also adding the correct folder to the /vendor folder. My issue now is that it’s not adding the actual font-awesome folder to the /plugins folder, therefore i’m unable to activate the plugin. Has anyone had this issue? Anything i’m missing?

There is a step to add a ‘require_once’, but i’m unsure where this would go and/or what its purpose is.
require_once __DIR__ . '/vendor/fortawesome/wordpress-fontawesome/index.php';

You’re installing it as a Composer package, not as a WordPress plugin, so Composer installed it as a package, in vendor. The documentation on the package you linked says as much:

This package is also available as a plugin in the WordPress plugin directory.

You could instruct your users to install that plugin separately. Once activated, using the PHP API works the same as if you had included this package via composer.

If you want to install it as a WordPress plugin through composer, you would need to install it through wpackagist, i.e.:

composer require wpackagist-plugin/font-awesome

Composer is a package manager that has no real awareness of what WordPress is, or what WordPress plugins are. The only way it knows to install certain things in WordPress’s plugins directory is that some packages have a wordpress-plugin type and Bedrock’s composer.json has some instructions for Composer on where to put those packages.

1 Like

Thank you for your response, that clear things up for me. I initially used wpackagist to add the font-awesome plugin, but for some reason the plugin added seemed different from the one we had initially used. I will review the other wpackigist font awesome options. Thanks!

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.