Seite auswählen

WordPress theme and required plugins

After some research we found some snippets for plugin required Themes. Some are a bit simple others where paied tutorials. We thought of an easy way to integrate them and came up with this solution:

this code will require the the contact-form-7 and the advanced-custom-fields-pro plugin – witch require a custom installation.

The important part is the $plugins array:

The key is the path after /wp-content/plugins/ of the plugin file.
The name should be the name of the plugin – here you are able to add a link like in the example.
The slug should be false if the required plugin is a custom one and not in the Wordpress reposetory – otherwise it should contain the slug{SLUG}.

The functions used in the snipped should also work for WP installations lower then 4.6.1 but where not tested. The error-message could also be a bit more bling bling but I’m sure this isn’t a challenge for anyone of you if you are searching for codes like this 😉

Developed for

  • WordPress 4.6.1 tested
  • As first lines of code inside functions.php of a custom or child theme
  • Should also work in any plugin

up to 11

It seems like there will be an new Plugin directory as soon as the switch will happen this snippet should get an update.

The function could also be used to get the requirement status e.g. inside the rendering of the page – just use it as