1

I'm developing a plugin. This plugin creating a new post type and displaying these posts in a custom template.

For example it's a event calendar plugin. This plugin creating a new post type 'event '. Users adding new events from wp - admin, like normal blog posts. And users creating a new page with 'Event Calendar ' page template.

But for enabling Event Calendar page template, users have to copy eventcalendar.php from plugin's dir to their template's dir.

Last step (copying file) is really hard for some users. Is it possible to call custom page template from plugin dir?

2

I second Tom's answer, however in the interest of answering your question, have a look at this question using the template_include filter.

2

Probably, but I would advise against this as you would have to make a template that worked with every single theme out there which is not possible. Many people will have broken templates no matter what you do.

Instead try adding a shortcode as a backup for those users who can't do that additional step.

  • i solved my problem with template_include(). Thank you. – Eray Apr 6 '12 at 22:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.