Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

A A
seal-mask
.a{fill-rule:evenodd;}techdegree
A A
Full Stack JavaScript Techdegree Student 19,812 Points

The WordPress Loop Websites How to Build a WordPress Theme WordPress Theme Functions The WordPress Loop

So the front page of the allisongrayce.com exercise looked like this:

This is the header

This is the font-page.php

This is the footer

After I did the wordpress loop exercise and put in this code:

<?php get_header(); ?>

<p>This is the front-page.php</p>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ) ?>

<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<hr>

<?php endwhile; else: ?>

<p>There are no posts or pages here</p>

<?php endif; ?>

<?php get_footer(); ?>

Exactly like the code from the video. Then refreshed the page on the localhost and it went blank. Any suggestions?

I'm on a mac using MAMP. My page in the reading settings are listed as static page with the front page: home and posts page:blog.

Don't know how to fix it. Please help.

2 Answers

Kevin Korte
Kevin Korte
28,149 Points

Found it,

I copied and pasted this code into the front-page.php of my current project and it kicked back the error code of an unexpected ")" on the loop.

This

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ) ?>

should be this

<?php if ( have_posts() ) : while ( have_posts() ) : the_post();  ?>
Kevin Korte
Kevin Korte
28,149 Points

Do you have a functions.php file? Are you using a stand-alone theme or a child theme?

Usually when the screen goes blank for me on WP it's because I have an error in my code inside my functions.php file.

A A
seal-mask
.a{fill-rule:evenodd;}techdegree
A A
Full Stack JavaScript Techdegree Student 19,812 Points

No I do not. Not in my folder of all the other .php files for the wordpress videos. I'm using the theme that we are creating in the tutorial video from treehouse