Web Design Forum: Wordpress Thumbnail Issues - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Wordpress Thumbnail Issues Rate Topic: -----

#1 User is offline   Chris Higgins 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 99
  • Joined: 02-January 09
  • Reputation: 5
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 29 January 2012 - 04:17 AM

Hi everyone,

I've posted this over at the Wordpress forum, but haven't had any replies so far. Having some issues with my featured images in WordPress 3.3.1. I have used this method on several websites in the past, but have only just started experiencing issues with it now.

CODE ADDED TO FUNCTIONS.PHP FILE:

<?php
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 200, 200, true );
?>


I then open one of my posts and try adding a featured image, only to receive the following error message in the upload box.

Warning: Cannot modify header information - headers already sent by (output started at /home/electric/public_html/wp-content/themes/electricmonk/functions.php:6) in /home/electric/public_html/wp-admin/async-upload.php on line 26

Interestingly enough, the image does appear to be uploaded to my wp-content/uploads folder. When I go into the 'Gallery' tab of the 'Set Featured Image' window, the image is there and I can select 'Use as featured image'. The thumbnail appears in the Featured Image box, but when I click 'Update', I get the following message:

Warning: Cannot modify header information - headers already sent by (output started at /home/electric/public_html/wp-content/themes/electricmonk/functions.php:6) in /home/electric/public_html/wp-includes/pluggable.php on line 866

Is there a solution for this bug that anyone could fill me in on?

Cheers,

Chris

This post has been edited by Chris Higgins: 29 January 2012 - 04:18 AM

0

#2 User is online   MikeChipshop 

  • Small but imperfectly formed
  • Group: Moderators
  • Posts: 7,045
  • Joined: 19-April 10
  • Reputation: 503
  • Gender:Male
  • Location:Scotland

Posted 29 January 2012 - 09:21 AM

Generally header errors like this are caused by extra white space or encoding problems in your themes files, particularly the functions file. Open up the file and make sure the file has no white space before or after the code.
0

#3 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,592
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 29 January 2012 - 10:32 AM

As it's started happening since you added that code block, that's probably the culprit. If your functions.php has a closing ?> before that block, remove it and that block's <?php - blank lines in PHP are fine, but blank lines outside of PHP get output to the browser. The last ?> in the file is optional, and I'd advise removing it as an extra safeguard.

This post has been edited by Renaissance-Design: 29 January 2012 - 10:33 AM

0

#4 User is offline   Chris Higgins 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 99
  • Joined: 02-January 09
  • Reputation: 5
  • Experience:Beginner
  • Area of Expertise:I'm Learning

Posted 29 January 2012 - 10:45 AM

View PostMikeChipshop, on 29 January 2012 - 09:21 AM, said:

Generally header errors like this are caused by extra white space or encoding problems in your themes files, particularly the functions file. Open up the file and make sure the file has no white space before or after the code.


Hi Mike,

Thanks for your reply. It gave me another idea.

I use an old version of Elliot Jay Stocks' 'Starkers' theme to build my sites. I usually delete this code, which is standard in the functions.php file.

<?php
if ( function_exists('register_sidebar') ) {
   register_sidebar(array(
       'before_widget' => '<li id="%1$s" class="widget %2$s">',
       'after_widget' => '</li>',
       'before_title' => '<h2 class="widgettitle">',
       'after_title' => '</h2>',
   ));
}
?>


For this site, for some reason, I hadn't bothered. As soon as I did, the error has ceased. Thanks so much for your help. It's very much appreciated.

Cheers!
0

#5 User is online   MikeChipshop 

  • Small but imperfectly formed
  • Group: Moderators
  • Posts: 7,045
  • Joined: 19-April 10
  • Reputation: 503
  • Gender:Male
  • Location:Scotland

Posted 29 January 2012 - 11:11 AM

Strange. That section is to do with marking up sidebar widgets with the relevant HTML.
Are you adding the <?php and ?> tags just I here for clarity or are they in your actual functions file?
The function file is a PHP document so you don't need them per block, white space could sneak in and cause havoc.

Glad you got it working tough.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users