Timeline for Custom Post Type with Templates using Meta Boxes?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 15, 2020 at 8:21 | history | edited | CommunityBot |
Commonmark migration
|
|
Jan 26, 2015 at 9:35 | comment | added | David Gard |
The white page error should now be corrected, but you are correct that if you place the template in a subfolder that it will not be found. However, could you not simply add the name of the subfolder to the template string? So locate_template( array( 'subfolder/' . $page_template . '.php' ) ) , obviously replacing subfolder with the correct folder name. Personally I would recommend putting templates directly into the theme folder though - it's just easier.
|
|
Jan 26, 2015 at 9:32 | history | edited | David Gard | CC BY-SA 3.0 |
Correct error where $template was not correctly returned
|
Jan 26, 2015 at 8:38 | comment | added | nerijusgood |
Well, this does not work, as well my file-name is not template name and its located in sub-folder, so applying name of template to php would not even make sense. I declare template within the php file: /* Template Name: name-of-template */ Anyway, this code gives me white page for any page ;/
|
|
Jan 23, 2015 at 15:04 | history | edited | David Gard | CC BY-SA 3.0 |
Amendment to code to include forgotten line
|
Jan 23, 2015 at 14:56 | history | edited | David Gard | CC BY-SA 3.0 |
added 33 characters in body
|
Jan 23, 2015 at 14:55 | comment | added | David Gard |
Out of interest, do you have debugging enabled via wp-config.php ? I didn't think you'd be noticied of an undefined variable by default.
|
|
Jan 23, 2015 at 14:55 | comment | added | David Gard |
Add global $post to the top of the function. I'll update the answer momentarily.
|
|
Jan 23, 2015 at 14:15 | comment | added | nerijusgood | Weird. Seems like good code, and used exactly as codex suggested, however now I get error "undefined variable: post" .. thoughts? | |
Jan 23, 2015 at 12:10 | history | answered | David Gard | CC BY-SA 3.0 |