Add cookie consent

hey there,
Iā€™d like to add my cookie notice just before the head tag

<link rel="stylesheet" type="text/css" href="//" />

thanks for your help

Hi There,

Please set up a child theme first:

After that adding the following code under functions.php file locates in your child theme:

add_action( 'wp_head', 'x_insert_header_scripts' );
function x_insert_header_scripts(){
	<link rel="stylesheet" type="text/css" href="//" />

Hope it helps :slight_smile:

1 Like

How would I change the stylesheet of the banner to my own. right now its using an external one //

thanks for your help!

Hi There,

Download that CSS file and then upload a copy on your child theme root folder. Then we have to update the code suggested previously to reference on the new file like below:

add_action( 'wp_enqueue_scripts', 'child_enqueue_styles');

function child_enqueue_styles() {

wp_enqueue_style( 'cookie-style', get_stylesheet_directory_uri() . '/cookieconsent.min.css', array());

See the following guide:

Hope this helps.

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