Cookie Disclosure for Wordpress

Wordpress Implicit & Explicit Opt-In Tutorial

It is possible to use the implicit and explicit Opt-In scripts in Wordpress.

Step by step

1.)  You can insert the scripts directly in the activated Wordpress themes header.php or footer.php.
Please note, that the explicit Opt-in script insert really first of all and before the first <?php section is opened in the code from the header.php.

2.) Wordpress child theme
A recommended method is to use a Wordpress child theme.

Make a Wordpress Child Theme with a header.php for the explicit Opt-in or footer.php for the imlicit Opt-in.

Note: For this example the parent theme is "twentyseventeen".

Create the folder:

Insert into the folder two new empty files with the filenames:

Add the following code in the:
Theme Name: twentyseventeen-child
Template: twentyseventeen

Add the following code in the:
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

Activate the child theme over the admin area sidebar menu:
Appearance → Themes → twentyseventeen-child → Activate

3.) header.php or footer.php
Copy or duplicate the original header.php for the explicit Opt-in script or the original footer.php for the implicit Opt-in script from the /twentyseventeen directory to the new /twentyseventeen-child directory.

Explicit Opt-in = header.php
Implicit Opt-in = footer.php

Insert the explicit Opt-in script code in the copyed or duplicated header.php in the twentyseventeen-child directory or the implicit Opt-in script code in the copyed or duplicated footer.php in the twentyseventeen-child directory.

PayPal Gefällt Mir Button
© - All rights reserved. Data protection statement & Imprint & Contact
Cookies in use.
More Infos