• I need to create a page (functional endpoint) from within a custom plugin I’ve written. The page should use the active theme’s default page template and allow me to dynamically create the_content from within my plugin.

    For the purpose of example I’ll call the endpoint (slug) ‘my-endpoint’. When loaded this page would be blank in the content area, but would contain menus, header, footer, sidebar, etc., as specified by the active theme’s settings.

    I haven’t had any luck finding an example of how this can be done dynamically. I have found examples that load a template I would create, but this isn’t the right way to do it if I always want the theme’s default page template to be used?

    The end result I’m looking for is like adding a page that contains a shortcode. At this time I’d prefer to not rely on a page being created and so I’m looking for a way of causing ‘my-endpoint’ to load up using the theme’s default page template and then have my plugin provide the content using the_content filter hook.

    How can this be accomplished dynamically without actually creating a page/shortcode or template?

  • The topic ‘Custom plugin page using theme template’ is closed to new replies.