Using custom page templates with plugin

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.

Read More

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?

Related posts

Leave a Reply

2 comments

  1. 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.