1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
<?php
namespace SIW\Modules;
class Cookie_Notice {
public static function init() {
$self = new self();
add_action( 'wp_enqueue_scripts', [ $self, 'enqueue_scripts' ] );
add_action( 'wp_enqueue_scripts', [ $self, 'enqueue_styles'] );
add_action( 'wp_footer', [ $self, 'render'] );
}
public function enqueue_scripts() {
wp_register_script( 'siw-cookie-notice', SIW_ASSETS_URL . 'js/modules/siw-cookie-notice.js', [ 'js-cookie' ], SIW_PLUGIN_VERSION, true );
wp_enqueue_script( 'siw-cookie-notice' );
}
public function enqueue_styles() {
wp_register_style( 'siw-cookie-notice', SIW_ASSETS_URL . 'css/modules/siw-cookie-notice.css', [], SIW_PLUGIN_VERSION );
wp_enqueue_style( 'siw-cookie-notice' );
}
public function render() { ?>
<div id="siw-cookie-notification" class="hidden">
<div class="container">
<div class="row">
<div class="col-md-10 cookie-text"><?php
esc_html_e( 'We gebruiken cookies om ervoor te zorgen dat onze website optimaal werkt en om het gebruik van onze website te analyseren.', 'siw' ); echo SPACE;
esc_html_e( 'Door gebruik te blijven maken van onze website, ga je hiermee akkoord.', 'siw' ); ?>
</div>
<div class="col-md-2 cookie-button">
<button id="siw-cookie-consent" class="button"><?php esc_html_e( 'Ik ga akkoord!', 'siw' ); ?></button>
</div>
</div>
</div>
</div>
<?php
}
}