Skip to:

Re: load an extension directly in a component (not in a plugin way)

John James Jacoby


When you are including directly code that is usually a plugin, you need to make sure that you include all of its dependencies before you proceed through the file you’re using to load that code.

In my opinion, the only way to make this transition is to do so knowing that you’re totally bypassing the ability to update the plugin and that it is now something that you’re including manually, either within your template or maybe even bp-custom.php. If the plugin itself was all you needed, then you’d just activate it and let it do it’s thing, right?

So, rather than hook the loading of those files into a WordPress action, load them via your parent themes’ functions.php file, and put that code in your parent/functions/ folder…

I try to keep things clean and logical, but I also reinvent a lot of wheels and re-factor existing WordPress plugins for my own custom applications. Breadcrumbs, taxonomy clouds, custom kses, etc… My parent themes are loaded with additional code that started out as someone else’s plugin that now is part of my theme. ( I know this goes against the entire reason why plugins exist, and I know it would be better karma to help contribute to a plugin than disassemble it and use its parts as my own, but sometimes that isn’t realistic, and sometimes it helps to see someone else’s perspective on how to achieve a goal. )

Maybe I misunderstood your question entirely… If so, then forget everything I just said. :)

Long story short, require ( WP_PLUGIN_DIR . '/bp-classifieds/bp-classifieds-groups.php' ); isn’t included everything that plugin needs to live. That file uses another file that’s missing.

Skip to toolbar