0

What is the best way to integrate a common library (like a framework) across multiple WordPress themes and plugins? Try to answer this from the library developer point of view. Keep in mind that this library is intended to be used by many users and for many plugins and themes.

  1. As an external plugin - Create a plugin that will be loaded before all other plugins to initiate the common library. Create a WordPress plugin repository and update it occasionally.

    • Pros - The library is more likely to stay updated.
    • Cons - Requires the user to install another plugin just to use the theme/plugin that depends on that common library.
  2. As a part of the depending theme/plugin - Include the library files inside the plugin/theme files.

    • Pros - No additional plugin installation is required.
    • Cons - Requires the depending plugin/theme to issue an update every time the library is updated. Ma create a conflict if different versions of the library exists within the same WordPress installation.

Are there any other ways? How would you do it?

  • 1
    Composer? – gmazzap Jun 13 '14 at 9:27
  • Unfortunately there is no best way whatsoever since WP core doesn't have concept of code dependencies. Do what works for you. – Rarst Jun 13 '14 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.