[wp-hackers] Template Hierarchy In A Plugin

Alex Andrews awgandrews at gmail.com
Mon Aug 8 08:20:22 UTC 2011


That's actually a good point. How would you implement this? Though I think the plugin I am developing is sufficiently specialist (i.e. it changes the whole feel of the site) that the interruption of template files is okay.

All the best,

Alex 

-- 
Alex Andrews
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Monday, 8 August 2011 at 02:33, Dion Hulse (dd32) wrote:

> I'd just like to point out, that allowing plugins to inject template
> files into themes is not always going to work properly.. Why? Quite
> simply because every theme out there is written with a different HTML
> structure and styling/class names.
> Try taking a page from the old Default theme and droping it into the
> 2011 folder, it's not going to work, Take a file designed for the 2011
> theme and drop it into a Genesis theme, it's not going to work.
> Take a file from a plugin and expect it to work in everyones themes..
> it's not going to work..
> 
> What everyone "actually" needs (IMHO) is:
>  * To modify the output of the_content() for their CPT or
>  * To be able to add pages with shortcodes easier (ie. so that
> /plugin-page/ is handled by their plugin)
> Neither of those would really be achievable by letting a plugin inject
> their document into the template hierarchy..
> 
> On 8 August 2011 05:33, Braydon <ronin at braydon.com (mailto:ronin at braydon.com)> wrote:
> > We really need to have full manual mode for URL and templates and take
> > WordPress to the Grand Prix.
> > 
> > On 08/05/2011 03:25 PM, Alex Andrews wrote:
> > > 
> > > Dear all,
> > > 
> > > What is the best way to take advantage of the way in which WordPress
> > > automatically guesses, and correctly loads the right template for a custom
> > > post type, but within a plugin rather than a theme?
> > > 
> > > So in a plugin I load a series of custom post types, and tell WordPress
> > > where the template files for them are, which it then loads in an automated
> > > manner. So album-single.php loads as we would expect if it were under the
> > > template directory and so on?
> > > 
> > > I attempted to Google this, but obviously quite difficult to get through
> > > the thickets of results to it out!
> > > 
> > > Thanks for the help,
> > > 
> > > Alex
> > 
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com (mailto:wp-hackers at lists.automattic.com)
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com (mailto:wp-hackers at lists.automattic.com)
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list