I have a plugin that I'm working on and I'd like the plugin to create and display custom content on a "page" created using a rewrite rule.
I've successfully created the rewrite rule with
add_rewrite_rule() and when navigating to that URL, I don't receive the "Page not found" error.
What I'm having trouble figuring out is how to have the plugin display content when that URL is accessed. I know how to do this in a theme with
get_template_part( 'content', $page_template ); but how can I have the plugin serve this functionality? The plugin can't add a file to the Theme, so how can I have custom page content (via the plugin) show up? Instead of using a theme's
page.php, I'd like the plugin to pull from
I've seen other plugins that do this sort of thing, but haven't been able to track down how it gets the content to the public user.
I'm sure I'm overlooking something fairly simple, but I'm having a hard time tracking down the issue, I'm not even sure exactly how to search for what I'm looking for.
Any help would be greatly appreciated.