Keeping themes self contained

Somewhere over there :point_left: on the old forum I posted a suggestion about having Pulse look for a plug-in by directory name rather than just the php file name in the hope of keeping the plugin file and supporting files all together in the same directory. It just makes things much easier for users to drop a single directory into Pulse rather than have to place certain files in certain directories.

Anyway… I’ve been thinking about how, ideally, Pulse should look for any asset in the theme location including plug-ins. The idea is that is you want to modify the regular gallery plugin to suit your theme you can place the plugin in your theme directory and, assuming the name is the same, it just works. Whoop.

It means you can easily fork plug-ins to do your own thing and extend their functionality without breaking sites that rely on them as, if the new plug-in is missing, Pulse will simply fall back to using the regular one. Double whoop! :thumbsup:

Here’s my first stab at getting this working in the main index.php file for Pulse;

if($get_embed == ‘template’){
$new_template = $tag_var1;
} else {
if (file_exists(“template/tags/$get_embed.php”)){
include(“template/tags/$get_embed.php”);
} else {
include(“inc/tags/$get_embed.php”);
}
$new = ob_get_contents();
}

2 Likes

This topic was automatically closed after 24 hours. New replies are no longer allowed.