WordPress.org

Support

Support » Themes and Templates » [Theme: dkret3] How to use favicons in 4.6?

[Theme: dkret3] How to use favicons in 4.6?

  • Upgraded from 4.5 to 4.6 and my child theme favicon has stopped working and shows the default dkret3 favicon. I see that the code has changed for doing favicon, but due to my ignorance, I can’t understand how it is working now.

    I don’t see in the example child theme what to change to make it work – I guess I need to put the new favicon code in functions.php into my functions.php and modify it in some way?

    Basically, can anyone give me an idiots’ guide to make it work again?! Thanks in advance!

    http://wordpress.org/extend/themes/dkret3/

Viewing 5 replies - 1 through 5 (of 5 total)
  • probably easier to locate the favicon and replace it with yours.

    it’s in dkret3/library/my-dkret3/library/

    and there’s one in dkret3/library/images/

    Don’t know why, but you can probably tell which one to replace

    Thanks, that’ll certainly work until we can figure out the child themes way to do it.

    Theme Author kretzschmar
    Member

    @kretzschmar

    Dkret simply is a full filtered theme. Therefore you can change everything through the use of own filters inside your child themes functions.php.

    In dkret3 the favicon is added inside functions.php (line 118):

    // add favicon for dkret3
    add_action( 'wp_head', 'dkret_add_favicon' );

    Wp_head is called inside header.php. Therefore the function “dkret_add_favicon” is added to the header of every page.

    You will find the functions of dkret3 inside “dkret3/library/functions”. The function “dkret_add_favicon” is saved inside “custom-template-tags.php” (line 29):

    function dkret_add_favicon() {
    $favicon = '<link rel="shortcut icon" href="'.THEME_IMAGES.'/favicon.ico" />';
    
    echo apply_filters( 'dkret_favicon', $favicon );
    }

    Actually this function just adds the html code for the favicon to the head of all pages.

    The best practise is to simply overwrite the ‘dkret_favicon’ filter.

    Inside your child themes function.php add these small code:

    function my_child_favicon() {
    	echo '<link rel="shortcut icon" href="'.CHILD_THEME_URI.'/library/images/favicon.ico" />';
    }
    add_filter( 'dkret_favicon', 'my_child_favicon' );

    This will actually overwrite the standard markup. Please change the URL if the favicon is not saved inside “my-dkret3/libray/images”.

    Many thanks for the help and explanation, (and thanks for making the theme and keeping it up-to-date)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Theme: dkret3] How to use favicons in 4.6?’ is closed to new replies.