Archived topic
What am I missing here?
1 reply · Started by Joe on August 16, 2021
When I try to create a template based of the "page.php" file in my GD Child theme all of the elements appear, but the content of the page is blank...
Thanks!
Here is what I have been try to use for my template:
<?php
/**
* Template Name: My Template Name
*
*/
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since Twenty Nineteen 1.0
*/
get_header();
?>
<?php
// Start the Loop.
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content/content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile; // End the loop.
?>
</main><!-- #main -->
<!-- #primary -->
<?php
get_footer();
Hi Joe,
Can you specify the desired results you want to achieve with this? Do you have any expected layout that should've appeared?
I'm not sure the contents added here are appropriate for page.php as some parts are added here aren't normally included on a normal page.php page.
page.php is normally for static pages (with post loop condition incase a static page is set as the blog index page). Here's an example of it - https://github.com/tomusborne/generatepress/blob/master/page.php