Code snippets question

Community Forums Forums Design Tips and Tricks Code snippets question

This topic is: resolved

This topic contains 3 replies, has 3 voices, and was last updated by  Ineke 1 year, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13429

    Ineke
    Participant
    Post count: 1

    I am a newbee to code snippets and like to upload a favicon. I found for functions.php:

    /** Load custom favicon to header */
    add_filter( 'genesis_pre_load_favicon', 'custom_favicon_filter');
    function custom_favicon_filter( $favicon_url ) {
    return 'http://www.mydomain.com/wp-content/images/favicon.ico';
    }

    I guess I only need to change $favicon_url,
    With the full url only,  or with ‘  ‘    , or something else?

    • This topic was modified 1 year, 6 months ago by  David Decker. Reason: Corrected code display
    • This topic was modified 1 year, 6 months ago by  David Decker. Reason: still corrected formatting
    • This topic was modified 1 year, 6 months ago by  David Decker. Reason: Corrected code display
    • This topic was modified 1 year, 6 months ago by  David Decker. Reason: still corrected formatting
    #13433

    David Decker
    Moderator
    Post count: 93

    Hi!

    No the variable you should keep intact otherwise things break!

    You only need to adjust this 'http://www.mydomain.com/wp-content/images/favicon.ico' to your needs. Just change the URL with full path to the favicon graphic in your project. Please keep the single quote at the beginning and the end intact. Then it should all work.

    The code snippet goes into the functions.php of your child theme — best placed at the bottom. Please make a backup of that file BEFORE any additions!


    #13493

    RonnyMac
    Participant
    Post count: 61

    Also, leave a copy of the favicon.ico file in your site’s root. Some browsers ignore the new location and simply expect the favicon file to be at the root level.


    #13514

    Ineke
    Participant
    Post count: 1

    Thank you, it works perfect now.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.