epicrevolt
Member
Posted 9 months ago #
So I am building a website (obviously) and I need a way to save a user specified category. When a user enters the website, they have to select a cell phone. Each phone has it's own category inside WordPress and I want it to remember it next time they visit.
I was thinking about sessions or cookies, but then I thought I would consult WP support forums to see if there is a better way. I am just having a session variable stored (category id) and when the homepage loads, it loads the posts from that category.
digibucc
Member
Posted 9 months ago #
cookies or login. if you don't want every user to have an account, than cookies.
here's the wordpress codex page that gives usage
epicrevolt
Member
Posted 9 months ago #
What I have so far.
User selects Manufacturer, then selects phone (dynamic select fields).
On the form submit, it goes to find.php, which in turn, checks if it's a valid category then saves it as "user_cat" cookie.
Now I got to figure out how to only load posts from that category. I will get back to this topic later (tomorrow)
digibucc
Member
Posted 9 months ago #
what'll you'll do is modify wp_query in any given page to use the category in the user_cat cookie. sorry idk exactly how to do that, but i think it should work.