Web Hosting Talk







View Full Version : Word Press Theme PHP code error


BluewaveHosted
04-06-2008, 10:42 AM
Hello,

I am trying to install this new theme on my Wordpress based blog, and the functions.php files ends with this code, that is being flagged by my Dreamweaver as invalid code:

<?php }

}



add_action('wp_head', 'mytheme_wp_head');

add_action('admin_menu', 'mytheme_add_admin');


Any idea how to edit/add/delete/move tags or characters there to make it valid?

Otherwise, when I try to open the http://mybloghere.com it says:

Warning: Cannot modify header information - headers already sent by (output started at /home/usernamehere/public_html/wp-content/themes/themename/functions.php:9)

Any suggestions would be appreciated. The coder must have left out something?

Sillysoft
04-06-2008, 11:03 AM
Well that error means data was sent to the browser so you cant run whatever function is trying to run like sessions or anything else that requires to run first before anything else. For testing purposes you could be ob_start() at the top of this script and re-run it.

Silly

Codebird
04-06-2008, 12:47 PM
try moving this code "add_action('wp_head', 'mytheme_wp_head');" to the top of the page

BluewaveHosted
04-06-2008, 01:07 PM
I tried both things and none worked. I wanted to say: I do not remember what exactly I edited, but it was in the area of the quoted php code that I added something that fixed everything, so I repeat: this is a code error.

I am sorry I do not remember what I did :) and pasted the same file over the modified one :(

Sillysoft
04-06-2008, 07:45 PM
Depends on your definition of a code error. Data is being outputted to the browser before some code that shouldnt. It could be that script or something in the include scripts. For example if you echo text out before a header command you will get that error.

Silly

foobic
04-06-2008, 07:59 PM
If that's really the end of the file then you're missing the closing php tag:
<?php }
}
add_action('wp_head', 'mytheme_wp_head');
add_action('admin_menu', 'mytheme_add_admin');
?>

Edit: also make sure you don't have blank lines after that closing tag.

BluewaveHosted
04-07-2008, 02:46 AM
Thank you all. I finally got the latest version of the file from the creator. It does end the same, but seems not to create errors in the output anymore. Thank you all for your support and alertness.