181 thoughts on “Add a header image to Thematic – the easy way

  1. Thankyou for this, i copied the code accross and have the box displayed but dont seem to be able to get the image to view what have I done wrong?

    • In the back end, under the Child Theme Options panel, do you see the image you uploaded? If not, chances are you don’t have writing permissions for your uploads folder. To fix this try and go into your FTP client and give the uploads folder 777 permissions.

      If you don’t have a FTP client you can always use Filezilla. Here’s a quick tutorial for it: Filezilla 777 Tutorial. Let me know if this worked for you!

      • Hi that didnt work, got a friend to have a look and there is something wrong with image uploading. He got it to work for other themes but i still can’t get it to work for thematic i have changed to a different theme for now.

        • Yes, 777 permissions are a security risk.

          Some servers won’t let you upload images if you don’t have 777 permissions. This means you won’t be able to use the media gallery from WordPress without these permissions on the /uploads folder.

          Only and only on the uploads directory should receive 777 permissions.

          To put it into perspective, if you can use the media gallery you will be able to use this script!

        • Thanks for the response, Christian. My server seems to allow more restrictive permissions, and it’s all working, so I’m leaving it at that. I did have to modify the php with the @fopen and @fclose. Hope this is ok.

          Thanks for a great tool!

  2. Great for newbies to WordPress, like me…got this error after paste and trying to update:
    Parse error: syntax error, unexpected T_DNUMBER in /home1/menopau6/public_html/wp-content/themes/sugar_cane/functions.php on line 10

    • Normally this code should have worked out of the box.

      From what I can see you’re using the Sugar Cane Child Theme. It already has php code inside it’s functions.php file so try and check that all the

  3. Ah! I tried to do this and it didn’t work… Now can’t even get to the page to fix it!

    Keeps saying: Parse error: syntax error, unexpected $end in /home/alexisgrant/alexisgrant.com/travelblog/wp-content/themes/thematic/functions.php on line 42

    Help!

    • Maybe something broken under the new WP 2.8 update? I modified functions.php, successfully loaded a header image, then got the following on logging out (and now I get this on login, and can’t get to the Admin/Dashboard page:

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/3/d94931308/htdocs/populardelusions/wp-content/themes/thematic/functions.php:91) in /homepages/3/d94931308/htdocs/populardelusions/wp-login.php on line 287

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/3/d94931308/htdocs/populardelusions/wp-content/themes/thematic/functions.php:91) in /homepages/3/d94931308/htdocs/populardelusions/wp-login.php on line 299

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/3/d94931308/htdocs/populardelusions/wp-content/themes/thematic/functions.php:91) in /homepages/3/d94931308/htdocs/populardelusions/wp-includes/pluggable.php on line 671

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/3/d94931308/htdocs/populardelusions/wp-content/themes/thematic/functions.php:91) in /homepages/3/d94931308/htdocs/populardelusions/wp-includes/pluggable.php on line 672

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/3/d94931308/htdocs/populardelusions/wp-content/themes/thematic/functions.php:91) in /homepages/3/d94931308/htdocs/populardelusions/wp-includes/pluggable.php on line 673

      Warning: Cannot modify header information – headers already sent by (output started at /homepages/3/d94931308/htdocs/populardelusions/wp-content/themes/thematic/functions.php:91) in /homepages/3/d94931308/htdocs/populardelusions/wp-includes/pluggable.php on line 865

      • Check out to see if at the end of the functions.php file after the last php closing tag “?>” there aren’t any spaces or characters. That’s probably the reason the header information error is appearing.

        • Hey,.. I’d been trying to figure this out for an hour,.. a simple vacant line (line18) in functions.php was all I needed to delete…works perfect now (setting up RSS feed). Thanks Cristi

  4. hi, i’m having the same problem as “melissa” (june 19th) – and working in thematic. i can’t seem to get an image to upload. nothing displays for “Current image:” and nothing shows up on the blog. i have tried redoing everything from scratch several times, and also made sure the uploads folder was given 777 permissions. can you explain to me how you resolved this problem?
    thanks!
    wu

    • Unfortunately we didn’t resolve the issue. I don’t know what the problem could be and I would need access to your wordpress account and to the ftp to debug this. If you can send this info over my contact form I can have a look tomorrow !

  5. Yeah, I am having a problem with the actual display of the header as well. I may be missing something simple here, but it seems that the “adding the logo image to header” section is not executing, though I am not getting any errors. I can upload fine (directory is 777), the image is actually displayed in the Child Options section, but no go on the site itself. Actually, there is one weird thing, for some reason on the child theme options page, my logo is displayed at the top (where you actually upload the logo), but the basic default (Kubric) header is displayed underneath that under “Customize Header”..I am guessing that is not supposed to be like that?

    • Nevermind, I am an idiot..well actually my excuse is that it is late (early?) here..I did not actually finish creating a full child theme..I will work on this some more tomorrow.

  6. Thanks! I had to make a small change to get it to work on Vista with PHP 5.

    The fread did not work so I replaced it with file_get_contents. The code is below for those interested. I commented out unused code.

    Thanks for the code!

    if($file_type==”image/gif” || $file_type==”image/jpeg” || $file_type==”image/pjpeg” || $file_type==”image/png”){
    /*$length=filesize($temp_file);*/
    $fd = fopen($temp_file,’rb’);
    $file_content=file_get_contents($temp_file);
    /*$file_content=fread($fd, $length);*/
    fclose($fd);

  7. thanks for the code. it works great. but i’m wondering if there is a way to make the logo centered once i upload the image.

    • You need to style the div with the id ‘logo-image’ like this

      #logo-image{
      text-align:center;
      }

      This code you have to add into your child theme’s style.css

      Also to make it fit perfectly you can play with css padding like so
      #logo-image{
      padding:10px 20px 0px 50px;
      }

      Hope this helps!

  8. Greetings Cristi: The code worked perfectly… until I logged out. I got the white screen of death when I logged back in. I deleted the header code from functions.php and was able to get back to my dashboard.

    I’ve made sure there are no characters after the php closing tag. I’m using WP 2.8.2. Is there a way to fix this?

  9. OK, I got this to work today. Last night at midnight, I kept trying this and was ready to pull my hair out. Then this morning, I suddenly thought – “hey, he doesn’t say where to add the code.” I had been trying to stick it where I thought it should go (with absolutely no knowledge of why it might go there!) This morning, I just put it at the beginning and it works! You Rock!

    The only thing is that it will only accept my .gif file that has a white background. It won’t accept the transparant .gif and it won’t accept a .gif with a colored background to match the background of my header. What .gives with this? Why will it only accept the gif with the white background?

    Thanks!

    • I’ve tested it with a transparent gif and a transparent png and it works just fine! Can you please check to see if you saved the gif correctly?

      • You’re right. No idea why it’s working now. I tried it several times before and I’m doing nothing differently. I always save for web & devices via either photoshop or Illustrator. Been doing this a very long time.

        Thanks so much for your help! Can’t tell you how much I appreciate it. Please let me know if I can do something for you guys.

        • I’m glad you sorted that out!

          As for what you can do for us? Just spreading the word about our themes or send a friend or colleague that needs custom web-design to us that would be great! Just don’t send them in the next two weeks as we’re off in vacation! :)

  10. Thank you, this is a good tip.

    I have manually added img alt attributes and a titles to my functions.php but this can be fairly easily added as an option (or alternatively could call the blog description to use as alt?). Img alt attributes assist people who may not be able to see your images for a variety of reasons.

  11. Pingback: Build WordPress Sites Fast With the Thematic Theme Framework | Es Developed - Fresh Website and Graphic Design

  12. thank you for the excellent code sharing! i successfully added my logo with the above function, but there is a huge amount of white space that appears above it on the page. how can i get rid of this?

    thanks!

  13. Hi Cristi,

    Thank you for the code – I created the child theme and then added the code to functions.php, and began getting this error immediately after saving:

    Parse error: syntax error, unexpected T_DNUMBER in /home/reddwarf/public_html/wp-content/themes/thematic/functions.php on line 3

    I can no longer access my theme editor – it just pops up with the same error. I have the most up to date version of WordPress. Any help would be appreciated!

    • Were did you add the text? Inside thematic functions.php or inside your Child theme functions.php?

      If inside Thematic, delete and reupload Thematic. If not, connect to the FTP, download the functions.php file, empty it, and upload it back to your child theme. The problem is a syntax error (meaning you forgot a ‘;’ or didn’t put the < ? php ? > tags correctly).

      • I added the text within my Child Theme functions.php – thank you for the speedy response! I’ll follow your suggestion and let you know how it goes.

  14. Sorry, I was talking about the general header image solution using the child theme described on this page. It’s not working with the latest Thematic version.

  15. I will try to see if I can duplicate the problem you are having. What is the site you are working on? I will try to help out when I get some free time.

  16. Hi Cristi,

    I am keen to use a child theme options page for other things, any ideas where I could get some info. Eg I have a custom homepage with a youtube vid. I want to make it easy to change without rewriting the .php code. A simple text box where I can put the embed code would be great, any info would greatly help.

    Phil

  17. Thanks! Works like a dream.

    Is there an easy way to just replace the blog name with the image and leave the slogan under it?

    I’m thinking that I might like to change the slogan every now and then. It would be so much easier to keep it as plain text and not add it to the header image.

  18. As you’ll see at my website, there is nothing but an error message. I really messed up. Can you help me figure out how to fix my problem?

    Parse error: syntax error, unexpected T_DNUMBER in D:\Hosting\3056829\html\wp-content\themes\thematicpowerblog\functions.php on line 198

    I popped the code into the Theme Function file in the Theme editor of my wordpress dashboard. It wouldn’t update and gave this error. So, I took the code back out and tried updating and everything is gone with only this error in it’s place.

    I appreciate the help!

  19. Alright, for some reason, the added code was still in the .php file on GoDaddy. I removed it there and have my site back.

    I’ve tried replacing the original code with this code in the wordpress dashboard, but it reverts back if I try to update. I plugged it in directly at GoDaddy where I’m hosted and it came back with the same error only on line 3. I removed the code.

    I’m using Thematic PowerBlog. Any ideas why this isn’t working?

  20. Thanks for getting back to me. I fiddled within the style sheet and got an image in and still have the title and description under it. It works for now.

    Off to the next problem. After all of this, now my browser and flash image uploaders both say: The uploaded file could not be moved to D:\Hosting\3056829\html/wp-content/uploads/2009/12.

    Yuk, if it’s not one thing it’s another. Maybe you have an article on that? I’ll look.

    • I believe I started another topic somewhere on here. I am able to upload images to my server, I think I can manually enter the html to put them in my pages and posts, not sure yet, but I found by searching around that there seems to be a problem. 2.8.5 Unrestricted File Upload Arbitrary PHP Code Execution has made my files accessible to whatever may have written into them.

      Thanks for your reply.

  21. yes, I’m all better now. Still needed some more help, but it’s all good. I’ll have time to check out the new features now that I’m over the image upload problem.

    Thanks

  22. I created the child theme folder. I opened the functions.php file and I have the following code:

    ‘Home’,
    // ‘sort_column’ => ‘menu_order’,
    // ‘menu_class’ => ‘menu’,
    // ‘echo’ => true
    // );
    // return $args;
    //}
    //add_filter(‘wp_page_menu_args’,’childtheme_menu_args’);

    ?>

    where do I add the code listed above in this blog in functions.php

    i appreciate all the help/.

  23. This is the code I have in functions.php

    ‘Home’,
    // ‘sort_column’ => ‘menu_order’,
    // ‘menu_class’ => ‘menu’,
    // ‘echo’ => true
    // );
    // return $args;
    //}
    //add_filter(‘wp_page_menu_args’,’childtheme_menu_args’);
    ?>

    where does the code in above post in the blog goes?

  24. I resolved the issue above…:)

    I was able to succesfully add the child theme folder.

    Now, when I try to upload the Logo, I get the following error:

    Warning: fopen(/tmp/phpTsOaIP) [function.fopen]: failed to open stream: Success in /home/content/a/b/e/aberrad/html/wp-content/themes/Thematic Child Theme/functions.php on line 24

    Warning: fclose(): supplied argument is not a valid stream resource in /home/content/a/b/e/aberrad/html/wp-content/themes/Thematic Child Theme/functions.php on line 26

  25. I deleted the thematic theme and the child theme. I reinstalled everything from scratch and I’m still getting the same errors. I think the problem is either in the code above or maybe something that has to do with my godaddy hosting account.

  26. @Amine it could be in the code then or certain upgrades done to WP could be causing it too. I use Go Daddy too so do not see a reason there.

    • TO THE ADMINS WHO WROTE THIS PAGE:

      I think its best if you delete this page since your code is not working. I have been trying this for days with no luck….:)

      • Sorry Amine to take so long to answer you. I’ve been away on a short vacation.

        What you’re experiencing is that your server isn’t allowing for your image to be uploaded.

        Try and put @ in front of fopen and fclose like so:
        @fopen
        @fclose

        It’s a long shot but it might work.

        • @ed @critsian@scott

          Thanks very much for your input.

          I added @fopen and @fclose and the good news is the error does not pop up anymore. The bad news is the image is still not there…:)

          As you can see from the website using internet explorer, the image is trying to show up but there is an X.

          http://www.isearchbankhomes.com

          I’m using godaddy hosting account and I set up the uploads folder to writing permission.

  27. Hello Armine –

    There is no need to delete this post. I have used the supplied code and tested it at a couple of installations, and it works fine. It has worked fine on both WP 2.8.6, and also now on version 2.9. If it works well on other sites, Armine, that means the problem may lie with your hosting set-up, how your L-A-M-P stack is configured, or even a tiny bit of code — just one character — accidentally deleted. Best of luck with it
    – Scott

    • I downloaded another theme (pixel) and I was able to upload the header without any problems….:) Not sure why the thematic child theme wont let me…

  28. dammmm it. my buddy from canada just figured it out for me and its something very stupid…lol

    this is his message:

    ou’re working with a linux web server for your site, so the file names are CASE sensitive, i.e. LOGO2.jpg and logo2.jpg are not same.

    Either you can rename the file to match what it is being called or change the way it is being called.

    . if you go to any page on your site and right click, IE or firefox will give you this menu item ‘view source’. Once you select that it’ll bring up a page in html, here you can search for that file ‘logo2.jpg’ and you can get more details.

    thanks for everyone for trying. its truly appreciated and thanks for the thematic and child theme. its truly appreciated. as someone famous said. there is no such thing as genius, its all about persistence……:)

  29. @Amine on a Linux server you have to be careful naming files. Always best to use all lower case alphabets or numbers, nothing else.

  30. Does it matter if you stick this PHP code at the bottom of your functions.php in Thematic? Or does it need to be somewhere specific?

    Thanks so much,
    k.n.

  31. Hi, I added the code to my child theme and uploaded a test image and it went up without a problem. I then switched it out with the same image (but with text added), and it now shows this:

    Warning: fopen(/tmp/php2jY71f) [function.fopen]: failed to open stream: Success in /home/reddwarf/public_html/wp-content/themes/thematic/functions.php on line 113

    Warning: fclose(): supplied argument is not a valid stream resource in /home/reddwarf/public_html/wp-content/themes/thematic/functions.php on line 115

    and the header is no longer appearing. Please forgive me if the answer is obvious, I’m clueless with this stuff.

    • just as an addition – the original test banner still works. What am I doing wrong with the new image? It’s the same file size, width and height, file type, etc.

  32. The text on the image looks to be the issue here. Does it work well without the text? Have you tried to overlay the text over the image or is the text part of the image itself?

    • I overlayed the text on the image via photoshop. The original image still works, but no other image seems to work, with or without text.

      I’m going to keep fiddling to see if I can discover what makes this image different from the others… any suggestions? You may want to try sending me an image that works for you to see if it works for me as well.

      Is it possible I added the code incorrectly and that’s the source of these inconsistencies?

  33. Have you tried to superimpose your text on your image in Photoshop and save it to your desktop? Then go ahead and upload it to your theme’s folder? I have done that at times to make text over images work.

  34. I added the code to my functions.php in my child theme and now I am getting this error:

    Warning: Cannot modify header information – headers already sent by (output started at /home/hypr/public_html/blog/wp-content/themes/johng/functions.php:104) in /home/hypr/public_html/blog/wp-includes/pluggable.php on line 868

    Not sure what I need to do to fix this. Any thoughts?

  35. I’m using Buddymatic with the basic Buddymatic child theme. I thought I’d give this a shot.

    I was really encouraged when, after pasting the above code into my theme’s function.php, I got the options page on my backend and it appeared to work flawlessly. That is, it let me upload my custom image and it appeared on the option page. Except that it didn’t actually change my site.

    I’m thinking maybe that there’s something simple that needs to be changed to make this work. Any ideas?

  36. Would it be possible to have rotating header images? Like for instance having a folder of header images, one of which is randomly chosen every time the page is loaded?

    Thanks

  37. Pingback: links for 2010-03-31 « Thoughts on Interactive Writing

  38. Pingback: Back to the roots of clear WordPress design

  39. prior to the commencement, let me say THX for this! I’ve implemented the code in my Thematic child’s functions.php. It works fiine and lets me change the header image and fade out blog’s title and description.

    Just one problem:

    Warning: fopen(/tmp/php2jY71f) [function.fopen]: failed to open stream: Success in /home/reddwarf/public_html/wp-content/themes/thematic/functions.php on line 113

    Warning: fclose(): supplied argument is not a valid stream resource in /home/reddwarf/public_html/wp-content/themes/thematic/functions.php on line 115

    I’ve checked the code several times: no unwary spaces, nothing that a. explains the error message or b. explains why everything’s working fine although I receive that message. Any idea?

    • Here’s the exact message:

      Warning: fopen(/tmp/phpbnhsuA) [function.fopen]: failed to open stream: Success in /home/web160/klem08/ftproot/www.kunstgriff-pix.org/wordpress/wp-content/themes/simply_sankt_pauli/functions.php on line 50

      Warning: fclose(): supplied argument is not a valid stream resource in /home/web160/klem08/ftproot/www.kunstgriff-pix.org/wordpress/wp-content/themes/simply_sankt_pauli/functions.php on line 52

      Your code starts @ line 28. There’s some code for a home link in the menu and a custom footer in those first lines.

  40. Pingback: Build WordPress Sites Fast With the Thematic Theme Framework ‹ Wordpress Expert – Just another WordPress Expert

  41. Help. I am very new to wordpress customization. I have successfully installed a child theme of thematic but am running into difficulty when adding this php code to functions.php. I save it and it says “file updated successfully” but then I don’t have a child theme options tab underneath appearances. Does the latest version of thematic support this, or am I missing a crucial step. It is for this site http://www.tybeenorthbeachrentals.com

    any and all feedback is greatly appreciated!
    Thanks!

  42. what is your opinion on how the loss of the header tags might affect SEO?

    i’ve been trying to tweak this so that you can have the image and the headers. it is easy to tweak the code such that the image is the background image for the h1 tag and text-indent away the link, but i find this only works when i know the specific dimensions, in which case why do i need an options panel.

    except that i want the options panel if i am developing a theme for public consumption… and i like to use timthumb so that i can keep a lid on the max size of the logo image.

    def havent figured this one out yet, but it is a great addition to an options panel!

  43. So I added the code and the admin section came up. When I tried to upload an image I got this message:

    “Warning: fopen(/tmp/php4zGvst) [function.fopen]: failed to open stream: Success in /home/content/88/6358288/html/wp-content/themes/thematic/functions.php on line 119

    Warning: fclose(): supplied argument is not a valid stream resource in /home/content/88/6358288/html/wp-content/themes/thematic/functions.php on line 121

    • Hey Felton.

      That error appears on certain hosts and to be honest I haven’t figured it out so far. Some php configurations work without any issues while others don’t.

      Try and have a look at this:
      http://webcache.googleusercontent.com/search?q=cache:l92Jmg-abbcJ:php.net/manual/en/function.fopen.php+Warning:+fopen%28/tmp/phpbnhsuA%29+function.fopen:+failed+to+open+stream:&cd=3&hl=en&ct=clnk&client=firefox-a

      It’s the fopen function over at php.net. Maybe it can help you.

      • After attempting to upload my image I’m getting a similar message. Errors are on different lines though:

        Warning: fopen(/tmp/phprpILcL) [function.fopen]: failed to open stream: Success in /home/alidabar/public_html/wp-content/themes/thematics-child/functions.php on line 24

        Warning: fclose(): supplied argument is not a valid stream resource in /home/alidabar/public_html/wp-content/themes/thematics-child/functions.php on line 26

        Concerning the first line, line 24, the copy & paste code uses the ‘rb’ mode as follows:

        $fd = fopen($temp_file,’rb’);

        line 26 looks like this:

        fclose($fd);

        Chris, I read the PHP manual you linked to and it looks like it might be a server issue but my other concern is that it might be a operating system issue? I am working on a Mac. Could it be this simple/dumb?

        I’ll try editing it in plain text (which is what I did originally-so I’ve tried copy and pasting in both plain text and my code editor) on my PC and report back. I’m wondering if the type is getting mixed up in the cutting and pasting, depending on what editor I’m using vs. what the original code was written in. Oh the little details!

        Keep me updated if anyone figures it out or has any other suggestions. Thanks!

        • PS. I’m also going to mess around with the modes and try ‘t’ vs. ‘b’ etc. as apposed to ‘rb’. Somebody let me know if I’m way off in left field on this one, please!

        • To be honest I never tested this in a Mac. File permissions could be different. I never tested this on a Windows server. Only on Linux.

          I’ll need to have a look at this code since it appears to be causing people issues sometime in the near future. Maybe I can come with another solution.

        • In my case I believe these errors were caused by “smart quotes” being used in the code. I replaced the smart quotes with straight quotes and the errors were resolved.

        • Replacing the smart quotes worked for me too. The original code listed above includes them. For those of you who don’t know, the smart quote is a ’ character, and the straight quote is a ‘ character. Very easy to miss!

          original code:
          $fd = fopen($tmpfile,’rb’);

          replacement code:
          $fd = fopen($tmpfile,’rb’);

  44. Hi Cristian, I’ve added the child theme, and the header image, however now the title shows up in the left under the menu. How can I hide it ?
    (if I dont use a title than it doesnt show up but there will be no title in the window browser)

  45. Hi there,
    I’m using Auto Focus Pro and I’m a bit confused when accessing the functions.php file –

    I have tried adding the code and saving, but nothing appears in my Appearance menu

    I feel I’m missing something glaringly obvious (and I’m not the biggest CSS guru.) Any help would rock, thank you. :)

    • Could be an issue with incorrect closing < ?php tags. Since you don’t get the white screen of “death” when you do this something else could be the issue, although I don’t know what.

      Do you have a link to your site so I can have a look?

    • Hi Sam,

      To be honest I don’t know what’s behind the Autofocus Child Theme. Also since you’re using the Pro Child Theme, if you payed for it there should be some sort of support for it from the author.

      I had a look at the Autofocus website and it said that in version 1.3: Added WordPress 3.0 Header script for custom logo. So perhaps an upgrade would be in order :)

      As for the slideshow, since I haven’t worked with this theme I don’t know what could cause it to not display it. If you made modifications to the theme and functions.php file chances are you made a typo or something like that and you get these bugs.

      My suggestion would be to backup the theme you have now and put the original one in place. You should have access to both the slideshow and the logo…

      Let me know if that worked out for you.

      • I did upgrade to the latest version.

        I am a rookie when it comes to CSS so looking through the functions.php file is a hot mess right now lol

        I see “Add New Thematic Blog Title” but how do you actually implement it?

        Thanks so much for your time btw. :)

        Sam

    • Sam please try and contact the theme author for these questions. From what I can tell, you can do what you want with the current theme, just that you don’t know how. So a clarification on his part would probably help you much more then I can. Just ask him for some screenshots or a walkthrough on how to add a logo :)

      • According to the author’s current website, he no longer offers support and recommends other help forums. SIGH. I guess too many people are having issues! :)

        // – Add new Thematic Blog Title
        function autofocus_blogtitle() { ?>
        <a href="/” title=”” rel=”home”>
        <?php }
        add_action ('thematic_header', 'autofocus_blogtitle',3);

        Does this piece of code from my thematic_functions php file have something to do with what I'm looking for?

        Thanks for your help Cristian.

  46. I like the admin panel but after trying this and several other methods i came up with one of my own which seems to be best suited for this purpose.

    This method is by far the best method. It keeps all the SEO optimized Thematic code and it simply adds an empty span to the header and styles it.

    The code is available on my site if you want to try it. If you like it please link to me and comment..

    Thematic Header Image

  47. Worked like a charm! I was having difficulties figuring out how to hide the #branding div, yet still figure out how to make my logo link to the homepage, this is great!

  48. great work, thanks!

    regarding the error:

    Warning: fopen(/tmp/phprpILcL) [function.fopen]: failed to open stream: Success in /home/alidabar/public_html/wp-content/themes/thematics-child/functions.php on line XX

    Warning: fclose(): supplied argument is not a valid stream resource in /home/alidabar/public_html/wp-content/themes/thematics-child/functions.php on line XX

    Please replace $temp_file with $tmpfile

    That worked for me.

  49. Worked for me.

    I wanted to have a background header image with a logo floated infront. The background image was easy enough using some css, but I couldn’t work out how to get a logo image to display . This worked straight out of the box. Bit of positioning and it was perfect. Thanks

  50. Adding header image is very interesting. I think I only change the colors of my header in the wordpress. It is because I don’t like to ruin my CSS codes so I just changed it on my free wordpress blog and not in my other blog. Thank you for sharing this.

  51. I modified this a bit to add in an alt (& title) value which is important for SEO & 508 compliance and if you want your markup to validate. The value is pulled from the site title in general settings.

    I replace this bit (line 91)
    echo ‘‘;

    with this:
    echo ‘‘;

  52. This is exactly what I needed, thanks for sharing :-)

    I modified your code a bit to include an alt (& title) value which is important for SEO & 508 compliance — and if you want your markup to validate. The value is pulled from the Site Title in General Settings.

    I replace this bit toward teh end (line 91)
    echo ‘‘;

    with this:
    echo ‘‘;

    • Ugg I think comment submission freaked out with the php code… it gave me errors with the first one I tried to submit and i refreshed several times but it didn’t look like anything went through, my 2nd one went through but not it looks like the first one did submit but i didn’t put the code blocks so none of them are showing my changes…

      Here it is again, code modified to include alt and title tags:

      replace

      echo '';

      with

      echo '';

    • code is still not showing… so I’ll just explain the changes

      You need to modify line 91 (the img tag)

      copy the src string (before the img tag close), rename src to alt and child_theme_image to blogname, copy again and rename alt to title.

      Now you’re logo will have a title and alt attribute. This value is pulled from the Site Title you give on the General Settings page.

  53. I added the code as suggested but it didn’t work – (fopen + fclose) warnings. Tried again but made mistake of including the and . I can no longer gain access to my WP site – not the administration. I got a screen that said “syntax error” about the functions.php. I should have copied the error message. Nothing worked so I deleted the functions.php out of the main folder and replaced with ‘Thematic’ .php . I now have a fatal error: “Fatal error: Cannot redeclare thematic_remove_generators() (previously declared in /home/e7411092/public_html/WP/wp-content/themes/minimalist/functions.php:134) in /home/e7411092/public_html/WP/wp-content/themes/thematic/functions.php on line 134″

    Is there a way to go back and correct the mess I’ve made? I’m working in a childtheme called ‘minimalist’. If I have to start again, I’m fine with that as I wasn’t far into my project BUT I can’t even get back to the admin page to change my theme. Please help!

    • Just delete the functions.php in your childtheme or replace it with the one in minimalist theme if you still have it. Then you should be able to login in the administrator.

  54. I used this code, slightly customized, to include a logo upload feature in a WordPress theme I created. I attempted to upload the theme to the WordPress Free Themes Directory but got an error related to some of the code from this feature….

    “WARNING: file_get_contents was found in the file functions.php possible file operations.”

    Is there any way to include this functionality in my theme without using “file_get_contents”, or “fopen”, and other code that the WordPress Theme Checker doesn’t like?

  55. I’ve used this code on another website and it worked perfectly, I have been trying to do it on my site and I get error messages. Can you please email me for some help?
    Daniela

  56. I have everything working in my wordpress admin panel, the child theme options and the logo image is previewing but the image isnt loading on my site. It doesnt seem to be creating a logo-image div either. Do you have any suggestions of what might be happening?

  57. Same for me as for Blaklipstick, but this all worked last time I used it on a site in early 2012. Are the problems due to incompatibilities with most recent WordPress or Thematic updates? Any ideas for fixes, or new solutions?

  58. Hi
    Found this very useful. I had a couple of errors when WP_DEBUG
    is enabled. Fixed them with following modifications.
    1. $wud['path']
    instead of $wud[path]
    2. $fd = fopen($temp_file,”rb”);
    instead of $fd = fopen($temp_file,’rb’);
    3. if (isset($_POST['options-submit']))
    instead of if ($_POST['options-submit'])

    Thanks

    $wud = wp_upload_dir();

    if (file_exists($wud['path'].’/’.strtolower($file_name))){
    unlink ($wud['path'].’/’.strtolower($file_name));
    }

Leave a Reply

Your email address will not be published. Required fields are marked *


5 + = eleven

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>