Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm not even sure this is possible but before I start thinking up crazy solutions, I'll see if there is a WordPress way to do it.

Here's the deal.

I have a timeline jQuery plugin all set up on WordPress and I want it to be callable in a child theme through the add_theme_support method:

add_theme_support( 'timeline' );

Call it an obsession with modular design. I've probably read too much Tadlock for any one man's sanity but it's working for me.

So the first part works just fine.

I've got the stylesheet & js file all conditionally enqueued if theme support has been specified and the one nagging problem is that I can't conditionally include a new page template. Having a "Timeline" template show up when timeline support is disabled is just bad UX design.

So here's the question - is there a filter method for conditionally inserting a global page template from outside of the usual locations? For example, if I were to put my page template in /library/inc/conditionals/page-timeline.php (effectively hiding it from WordPress), how could I filter it back into the template list on a page? If I can figure that out, I can add the filter to my add_theme_support function, angels will fly, trumpets will sound, and I will be happy.

The problem is that I'm not familiar with that particular drop box or how to invoke it in an unusual way.

Thanks for your brains! (not-in-a-zombie-way)

share|improve this question
    
Some helpful information about how to manipulate the WordPress template dropdown: wordpress.stackexchange.com/questions/96426/… So basically you could place kind of wrapper template inside your theme, which calls your timeline via get_template_part . Just my thoughts as starting point. –  rfrq Jul 18 '13 at 11:10
    
Thanks rfrq! Justin Tadlock gave me a typically incredibly complete answer over on his forums at themehybrid.com. The short version is that they have been waiting to push this into the core for three years: core.trac.wordpress.org/ticket/13265 -- and at present there isn't a hook for this. The best answers had to do with a function that conditionally removes a template from a child theme. –  Imperative Ideas Jul 19 '13 at 15:24
    
For anyone who needs to remove a template in a child programatically, the rather cumbersome function to do so is here: wordpress.stackexchange.com/questions/96426/… –  Imperative Ideas Jul 19 '13 at 15:36
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.