0
votes

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.com/foo, nothing seems to work - I keep getting a blank white page and no errors. Any ideas why this is?

I appreciate any suggestions.

3

3 Answers

0
votes

If you specifically need to make a page template, read through the Page Template Files section of the Theme Developers Handbook.

The key takeaways would be that you need a Page Template Header in the file, which at a minimum would include a Template Name like so:

<?php
/*
    Template Name: Foo Content
*/
// Your code here

As well as you would then go into your wp-admin and make a new page, and select your Foo Content page template in the template selector on the right hand side.

You may also look at the Template Hierarchy if it's not specificaly "Page Templates" that you need.

0
votes

Have you included an index.php file? Without it your website won't have a starting point, you won't see any errors but just a blank page. I would ensure you have an index.php in there. It should contain:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
0
votes

If you create a new WP template (as a php file), you afterwards have to create a page in the Wordpress backend and choose that template file as the template for you newly created WP page. Then the url for that page will be the slug of that WP page. Open the file from within the WP editor after you save it, then you see its URL.