0

I am using the following inside images-options which is linked to functions.php.When clicked on submit button it crashes in wordpress admin

<th scope="row">Image 1:</th> 
<td>
<input type="text" name="director_image1" value="<?php print get_option('director_image1'); ?>" />
<br/>
</td>
</tr>

I am using this to get the image in header.php.

var theImage=<?php $image = get_option('director_image1');?>
<?php if( $image) : ?>
<?php echo "'".$image."';"; ?>
<?php endif; ?>

And finally i am using theImage variable inside a javascript file :

{
 src: theImage
 fade: 3000
 }

Could you please help me out the image is not being displayed.

The console gives me this error: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/wp-content/themes/GapInvite/images-options.php:2) in /Applications/MAMP/htdocs/wp-includes/pluggable.php on line 896

  • 3
    This question is confusing, perhaps because your code is disjointed and out of context. It is not possible to tell exactly what is happening. Please improve this question. – s_ha_dum Apr 8 '14 at 12:50
0

The first thing to check with a 'headers already sent by...' error is that you have no white space at the very start or the end of your php file. Check your images-options.php file and remove any errant space at the very start or the end of your code.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.