Can't locate <head> in php

Hi!

I’m trying to add the following link to the <head> of my site.

<link rel="stylesheet" href="path/to/elusive-icons/css/elusive-icons.min.css">

Sadly I haven’t been able to find the head however. Where in the PHP can I find this?

Hey Vink,

It would be better to use the wp_head or wp_enqueue_scripts hooks to do this.

Please install and activate the child theme and login through FTP then edit the functions.php then add this code:


add_action('wp_head', 'add_header_code');
function add_header_code(){
?>
    <link rel="stylesheet" href="path/to/elusive-icons/css/elusive-icons.min.css">
};

or

function site_scripts() {

    wp_enqueue_style( 'exclusive-icons', 'path/to/elusive-icons/css/elusive-icons.min.css' );

}
add_action( 'wp_enqueue_scripts', 'site_scripts', 100 ); 

https://developer.wordpress.org/reference/functions/wp_head/

https://developer.wordpress.org/reference/functions/wp_enqueue_style/

Hope this helps.

Hi,

Thanks! But sadly it doesn’t seem to do what it should do. The first bit of code crashed my site.
The second one doesn’t give any immediate problems but I can’t insert the icons I should be able to, with the code in the site.

Maybe there is something I’m overlooking?

Hello Vink,

Thanks for updating the thread.

An easier to use option would be to use Header and Footer plugin and place the code in header text box.

If you want to use the child theme method then please copy _header.php from /wp-content/themes/x/framework/legacy/cranium/headers/views/global/ to /wp-content/themes/x-child/framework/legacy/cranium/headers/views/global/.

Once you have copied the file under child theme then add the link after <?php wp_head(); ?> code.

Let us know how it goes.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.