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

Marius Serban
Marius Serban
7,115 Points

How to Build a WordPress Theme - error on work.php page

Hi guys,

I have two problems building my WordPress Theme.

  1. Whenever I update any of my work pages I get a blank screen. I turned on the php errors and what I get is this:

Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/allisongrayce.com/wp-content/themes/wpportfolio/functions.php:45) in /Applications/MAMP/htdocs/allisongrayce.com/wp-admin/post.php on line 235

Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/allisongrayce.com/wp-content/themes/wpportfolio/functions.php:45) in /Applications/MAMP/htdocs/allisongrayce.com/wp-includes/pluggable.php on line 1121

  1. Also, even though I have my images already in my media, when I am for example on Stop Visual Pollution page and I want to add the images to the post I get...nothing. The little circle, I don't know the name of it :P it keep loading and loading and nothing happens.

Thanks in advance!

7 Answers

Aaron Jackson
Aaron Jackson
5,644 Points

I took a look at that pluggable.php screenshot...If your following along with the tutorial you don't need that pluggable file unless you have plans for it. But if you are going to use it. You might want to check out this link. http://codex.wordpress.org/Pluggable_Functions You will have to wrap your function with this ( !function_exists() ) otherwise you will get that error you getting. Hope this helps!

Aaron Jackson
Aaron Jackson
5,644 Points

Can you post the code in your functions.php ?

Aaron Jackson
Aaron Jackson
5,644 Points

The code that you have a screenshot of looks fine. Can you show me what you have on line 45 in your functions.php file? Also, what part of the tutorial section are you on? That will help me narrow down exactly what section to look at.

Aaron Jackson
Aaron Jackson
5,644 Points

Try changing line 24 to this

wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery') , '',true );
Marius Serban
Marius Serban
7,115 Points

Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/allisongrayce.com/wp-content/themes/wpportfolio/functions.php:45) in /Applications/MAMP/htdocs/allisongrayce.com/wp-includes/pluggable.php on line 1121

This is what I get now. :(