• A quick question about page templates.

    I built a plugin that is severely messed up by a right hand side bar and when discussing the possibility of disabling it from the plugin, someone suggested I use a page template where the plugin installs to.

    I’m looking at that but it seems doing that would mean the user would need to upload the page template to their theme folder.

    Is that correct? Would a user have to load the page template to their theme folder?

    I’m not sure if I want to have the installer go to that trouble quite yet and prefer an easier installation system if there is one.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    That is one way, though obviously undesirable for several reasons. It used to be one could change the path (in post meta) to the template after the page itself is created to avoid the need to use the theme folder. Something changed along the way and this simple hack no longer works.

    Somebody on here found code that fools WP into thinking a template in a plugin folder actually resides in the current theme’s folder. They posted it in these forums because it had a small problem which I was able to fix. The repaired code is here: http://pastebin.com/t5KukZL9

    It can be easily added to any plugin. It does require you to hardcode your templates (line 73). I haven’t tested it since the last few major upgrades, let us know how it works for you.

Viewing 1 replies (of 1 total)
  • The topic ‘Page template use in plugin development’ is closed to new replies.