jeudi 20 décembre 2018

Show specific custom post category posts to visitors based on their preference/input/actions

I'm setting up a new WordPress site, and my goal is to let visitors choose their location (city) and that only custom posts within the city selected by the visitor will show.

This choice will be something that new visitors will be prompted to choose when they first visit the site. Can be compared to the functionality of the new GDPR popups that we see on a lot of websites these days.

What I have thought about is setting a cookie when the visitor clicks on one of the buttons (chooses the city), and then running an if/else statement to check what cookie is present before displaying the specific posts to that visitor.

I am wondering if someone has done this before and if not this approach, then what approach you would recommend.

Aucun commentaire:

Enregistrer un commentaire