What is wrong with my code in index.php? or maybe not in my code? I’m creating a new theme from scratch. Direction of files is correct. Theme is activated. But text is not showing up.
<?php
get_header();
if(have_posts()) :
while (have_posts()) : the_post(); ?>
<h2>hello</h2>
<?php the_content(); ?>
<?php endwhile;
else :
echo '<p>No content found</p>'
endif;
get_footer();
?>
You are missing a semicolon.
echo '<p>No content found</p>'
should beecho '<p>No content found</p>';
, hence why you are getting the white screen of death. So the full code, looks like so:If you are using WordPress 4+ and in development, you should edit your wp-config.php file in the project root. Set the constant
WP_DEBUG
on line 80 to true to look like this:define('WP_DEBUG', true);
This will show the syntax errors in your code instead of a white blank screen…and of course change it back to false when you ship the production version.