• Hey guys! I have developed my own WordPress theme based on the Roots starter theme. Because of my clients needs, I’m often required to develop custom features (what I refer to as “modules”) that are added to the core: for example a “Projects” custom post type, a “Business Hours” page in the admin, or a custom “Slider” menu, etc.

    There’s a couple reasons why I decided to code these modules and extend the theme instead of using existing plugins:

    • It’s a great way to learn WordPress
    • I need to bundle and activate the modules dynamically in every new projects
    • I don’t want the clients to be able to deactivate the features (unlike plugins)
    • I don’t want to rely too much on third-parties
    • For consistency matters, I like if the code is similar everywhere
    • Flexibility: from my experience home-made modules are often easier to understand, maintain, and improve in the future

    I do however understand that building my features as plugins would brings a better code separation and have it’s benefits.

    So here’s my question: Should I keep building and adding the new features directly to the theme, or develop them as plugins instead? What is the best approach based on your knowledge and experience?

    Any input or documentation would be very appreciated. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • One advantage that developing your modules as plugins would have is that you can update the modules-plugins separately from the actual themes. Whether that would be a big advantage or not would depend on how often you need to update the modules, of course. Plugins would also be more flexible; e.g., if a client didn’t need a “Projects” post type, just remove the plugin, and you can easily add it back in later if the client’s needs change.

    Thread Starter Frank

    (@frkparent)

    Great point: the ability to update each plugins separately is significant. If I consider this option, there are still a few concerns though:

    • How to I prevent the user from deactivating a plugin?
    • Is there a better way to require plugins when activating a theme beside the TGM Plugin Activation library? I guess I could always create some kind of script that would activate the theme with the right modules at the start of the project…

    Check out this link to prevent clients from deactivating plugins. I’m not aware of any solutions other than TGM. You bring up a good point, though. Plugins are more flexible but less “idiot-proof”, whereas coding in all the modules makes updating a bit more difficult for you but clients are protected from their own curiosity.

    Thread Starter Frank

    (@frkparent)

    Thanks mate, I think it’s a great solution and I’ll change my approach!

    What about limiting access to these plugins via roles?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Extending a theme: build new features as plugin or core modules?’ is closed to new replies.