1

WordPress v 3.0.4 multisite-network enabled, local installation w MAMP 1.9.4, PHP 5.3.2, Theme: Twentyten child

TWO PROBLEMS: 1) Display of header image thumbnails in admin panel and 2) path to favicon.ico for child theme (used for main site at root) - both defined in the functions.php file inside child theme folder.

Created 'functions.php' file in child theme folder, implementing code by David Cox of Digital Raindrops, as posted up at digitalraindrops.pastebin.com/B3mPW3RD, with slight modification to allow for calling favicon, also to allow for second menu.

It does work - the image thumbprints are showing up, and I can select them; HOWEVER, the display is wonky. In the admin panel under “Header” | Default Images, immediately below the text “If you don‘t want to upload your own image, you can use one of these cool headers”, there is a lone radio button, and beside it and slightly stepped down, a row of 2 header image thumbprints I’m using, and then to their right, slightly stepped up (on the same level with the first radio button on the far left), two more radio buttons, beside the names of the images but without thumbprints. My description is perhaps confusing, and if you agree that a picture is worth a thousand words, take a look at imgur.com/AHmLQ.png.

Shall I paste the code here? Warning: it's long, and I've already pasted it over at wordpress.pastebin.com/wMmTF1Zc.

Sorry, this is a local installation, so no link to my website.

If anyone can help spot what I’m doing wrong, will really appreciate it.

Oh - and I'm having trouble with the path to the favicon.ico. The image is located in wp-content/themes/twentyten-child-main/images/. The code is placed at the top of the functions.php file:

<?php /** Twentyten child theme: twentyten-child-main */ function favicon_link() { echo '<link rel="shortcut icon" type="image/x-icon" href="/wp-content/themes/twentyten-child-main/images/favicon.ico" />' . "\n"; } add_action('wp_head', 'favicon_link');
1
  • Found the answer to the 2nd problem. Inside functions.php, at top: [blockquote]&lt;?php /** Twentyten child theme: twentyten-child-main */ $themename = 'twentyten-child-main'; function add_theme_favicon() { ?&gt; &lt;link rel="shortcut icon" href="&lt;?php echo bloginfo('stylesheet_directory') ?&gt;/images/favicon.ico" &gt; &lt;?php } add_action('wp_head', 'add_theme_favicon');[/blockquote]
    – Das
    Feb 19, 2011 at 13:06

2 Answers 2

1

After removing the .DS_Store file from the images/headers folder, the Header admin panel is displaying the header image thumbnails perfectly!

And yes, it is important to remove .DS_Store files before migrating the site to live server, or they will hitch a free ride and end up on the server.

So Mac users, pay attention. To remove .DS_Store from any folder, open Terminal and navigate to the folder.

cd path/folder/ (example: cd Documents/ followed by cd Websites/ followed by successive folders all the way to the child theme's 'images/headers' folder)

ls -al (displays all files, including . and .. and .DS_Store)

find ./ -name ".DS_Store" -depth -exec rm {} \; (removes .DS_Store from this directory and all subdirectories)

Now the code from David Cox over at Digital Raindrops is working beautifully - allows for locating header images in the child theme's folder, where they will not be vulnerable to overwrite - AND - also generates the display dynamically - no need to manually add to array every image you create; simply create header images and thumbnails and save to the folder designated in the code. :)

0

Found the answer to the 2nd problem. Inside functions.php, at top:

<?php

/** Twentyten child theme: twentyten-child-main */

function add_theme_favicon() { ?> <link rel="shortcut icon" href="<?php echo bloginfo('stylesheet_directory') ?>/images/favicon.ico" > <?php } add_action('wp_head', 'add_theme_favicon');

But having no luck finding the solution to 1st problem. :(

3
  • Partially solved 1st problem. In the parent theme's functions.php I had entered into the array the 2 images I'm using for the child themes. When I moved the two images out from the parent theme's images folder to the child theme's images folder, I forgot to remove the entries from the array. Now that the parent theme's functions.php is restored, the 2 radio buttons with names of the images over on the far right have disappeared. The 2 thumbnails correctly display. BUT a lone radio button remains on the far left - no name, no image. Any ideas?
    – Das
    Feb 19, 2011 at 15:44
  • Firebug found the culprit to be the hidden file .DS_Store inside the folder where the header images reside. The code employed in the functions.php file somehow recognizes this hidden file and turns it into a 'thumbnail'. Could it be that this is only affecting the local install on the Mac computer and will not occur when the site goes live on the Unix server?
    – Das
    Feb 19, 2011 at 17:37
  • Better use (updated) function get_stylesheet_directory_uri() instead of bloginfo('stylesheet_directory') for images Dec 10, 2017 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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