Question:
I have a website where the homepage exists out of 2 options to choose from:
Option 1: Familie
Option 2: Buiten seizoen
When a user clicks on one of the choices, a cookie has to be set. Remembering the choice as well. (the redirect to another page)
I have this now installed in functions.php:
function my_page_template_redirect() {
if ( isset( $_COOKIE["landvanbartje_cookie"] ) ) {
if( $_COOKIE["landvanbartje_cookie"] == "buiten_seizoen" ) {
wp_redirect( '/omgeving-rust-ruimte/' );
exit;
}
}
if ( isset( $_COOKIE["landvanbartje_cookie"] ) ) {
if( $_COOKIE["landvanbartje_cookie"] == "familie" ) {
wp_redirect( '/homepage-gezinsvakantie/' );
exit;
}
}
add_action( 'template_redirect', 'my_page_template_redirect' );
}
So I have set the redirects and named the cookies. Where and how do I install them on the 2 different pages? Anybody?