ThemeShaper Forums » Thematic

[closed]

Adding a Favicon with a child theme

(11 posts)
  • Started 11 years ago by scarParisO
  • Latest reply from flick
  • This topic is resolved
  1. scarParisO
    Member

    Hello, i have looked at the tutorial here on ho to add a favicon using a child theme but i'm still confused as what to do.

    I tried adding this to the header.php of Thematic under wp_head:

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

    I added this but it returned syntax errors i couldn't reach the end of. Do you add this to header.php of the main theme or do you add it somewhere on the child theme?

    Thanks for any help :)

    Posted 11 years ago #
  2. That function belongs in the functions.php file of your Child Theme. If that were the only thing in there your file would look like this

    <?php
    function childtheme_favicon() { ?>
        <link rel="shortcut icon" href="<?php echo bloginfo('stylesheet_directory') ?>/images/favicon.ico">
    <?php }
    
    add_action('wp_head', 'childtheme_favicon');
    ?>
    Posted 11 years ago #
  3. I added that code to my functions.php, but the favicon is still not showing. I even tried emptying the cache in Firefox, and refreshed several times.

    The icon is in the images folder of my child theme. Is that the wrong place?

    Posted 10 years ago #
  4. I just tried this every which way but loose too. No luck. Would you mind elaborating on this process a bit more?

    Posted 10 years ago #
  5. Copy the favicon to the root. Works with nearly all browsers.

    Chris

    Posted 10 years ago #
  6. When you do this, and paste it in like Ian showed(and it's NOT the ony thing in there, remember to take out the extra <?php's and ?>'s, or else you get a parse error on your backend.

    Posted 9 years ago #
  7. This is kinda funky, I've done all the above steps to my knowledge, and the favicon works on my backend, bu NOT the front. Any ideas?

    Posted 9 years ago #
  8. @meneldor: If it's the website in your profile, your link rel code occurs twice - once in Line 95 and the next in Line 105:

    <link rel="shortcut icon" href="http://www.jacoblysgaard.com/wp-content/themes/thessia/favicon.ico">
    <link rel="shortcut icon" href="http://www.jacoblysgaard.com/wp-content/themes/thematic/favicon.ico" />

    As the /thematic/ one occurs later, I'm assuming that the browser is trying to load this favicon (which doesn't exist) instead of the favicon in /thessia/ (which does exist)?

    Posted 9 years ago #
  9. I added a favicon to my root directory and its working (didn't have to add any code).
    Make sure you clear your browser's catch. Mine wouldn't show up at first because of it.

    Posted 9 years ago #
  10. Thanks Flick, I think that did the trick.

    Posted 9 years ago #
  11. @meneldor: I can see your J favicon! :)

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.