0

there are many plugins that do some job but can i add custom code for example: <link href="http://buhehe.de/wp-content/uploads/2017/12/Buhehe.ico" rel="shortcut icon" type="image/x-icon"> </head> from Function.php?

1

Yes, you can:

add_action('wp_head',function() {
  echo 'your html here';
});

However your .ico file should be put in a place it can't be purposely or accidentally deleted, like your theme folder beside your functions.php. Once done you can then use the following to construct the URL:

add_action('wp_head',function() {
  echo '<link href="'.get_template_directory_uri().'/Buhehe.ico" rel="shortcut icon" type="image/x-icon">';
});

Note if you already have a shortcut icon in the source code, the browser will pick whichever one its designed to pick (first or last).

1
1

You can add any code to head tag with the wp_head hook

function hook_link() {
    ?>
        <link href="http://buhehe.de/wp-content/uploads/2017/12/Buhehe.ico" rel="shortcut icon" type="image/x-icon">
    <?php
}
add_action('wp_head', 'hook_link');
0

Feel free to experiment, put code given below inside enqueue style function in your functions.php:

wp_enqueue_style('identifier_for_your_file', 'http://buhehe.de/wp-content/uploads/2017/12/Buhehe.ico');
0

Try This

add_action('wp_head', 'my_shortcut_icon_func' );

function my_shortcut_icon_func() {
  echo '<link href="'.get_template_directory_uri().'/Buhehe.ico" rel="shortcut icon" type="image/x-icon">';
}

Add the above in your theme's functions.php file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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