I am currently working on a project that uses a child theme (storefront is the parent theme). I need to be able to code using pure php / javascript (outside wordpress admin). Other custom template pages have *-content.php
structure, such as: foo-content.php
.
I created the custom page I'd like to develop on. However, when visiting the url, I am getting a blank white page. I am having a hard time understanding why this is.
Additionally, I tried going to wordpress admin and creating the page in the admin so it matches the file name I created my.domain/foo
, nothing seems to work - I keep getting a blank white page and no errors. Any ideas why this is?
I appreciate any suggestions.
I am currently working on a project that uses a child theme (storefront is the parent theme). I need to be able to code using pure php / javascript (outside wordpress admin). Other custom template pages have *-content.php
structure, such as: foo-content.php
.
I created the custom page I'd like to develop on. However, when visiting the url, I am getting a blank white page. I am having a hard time understanding why this is.
Additionally, I tried going to wordpress admin and creating the page in the admin so it matches the file name I created my.domain/foo
, nothing seems to work - I keep getting a blank white page and no errors. Any ideas why this is?
I appreciate any suggestions.
Share Improve this question asked Jan 31, 2019 at 17:42 AnchovyLegendAnchovyLegend 1271 silver badge8 bronze badges 1- 1 If you are getting a white screen, that is probably because of a fatal error in the code. So looking at the error.log file (and sharing it if needed ; add to your question) will help you (and others here). And take a look at the Template section of the codex on how the get_template_part() function works to understand how to call a template 'part'. – Rick Hellewell Commented Jan 31, 2019 at 18:59
1 Answer
Reset to default 0When you create a template page, it does not create a WordPress URL for it. So for example, if you create a PHP file called contact-content.php
it doesn't generate example/contact/
.
If you don't want to manually create a page and assign a Page Template to it (which by the way would normally be named something like tpl-content.php
- the PHP comments are what designate it to be a Page Template you can select in the editor), you can add code in your child theme so that upon activation, it automatically creates a Page with whatever slug you want. If it's just your site, you'll know your permalink structure so you can be sure the URL will be what you wish. If it's something you're applying to many sites with different settings, you may still face the issue of different styles of permalinks - i.e. example?p=123
versus example/contact/
.