Code to add template to page

A plugin creates a set of pages and a template. There must be some method to assign the template to one of the pages. I’ve attempted to adapt the method shown at filter reference template_include without success.

The page slug is member-register, the template file name is member-content-template.php.

Some of the things that don’t work include:

  • locate_template(): I suspect that because the template was created by a plugin it is not found by a function that appears to only search themes.
  • is_page(): If given the argument of the page’s title, slug or id returns false.

Read more here: Code to add template to page

Leave a Reply

Your email address will not be published. Required fields are marked *