• Hello.

    I would like to create a custom page template in subdirectory. For examplein …wp-content/themes/mytheme/page-templates/my-template.php

    I discovered the following attached code, but I do not know how to use it.

    In which file I have to paste the code below? functions.php?

    Thanx for help.

    add_action('template_redirect', 'template_overrides');
    function template_overrides()
    {
        if( is_page('potd') ):
           include(HOMEPATH . '/potd_/potd.php');
           exit;
    
        //fallthrough to default
        endif;
    }
  • The topic ‘A custom page template in subdirectory’ is closed to new replies.