• Projetct of Advertisement System

    Custom Post Types:

    States/Cities – localhost/category/state/city
    Coupons – localhost/site/coupons/post-name
    Ads – localhost/site/ads/post-name
    Enterprises – localhost/site/enterprises/post-name
    Users use a select to choose state and city (it’s required).

    So, they are redirected to a page url like: https://localhost/sp/jundiai/

    This page is a subcategory. City(Jundiaí) is children of State (SP).

    Coupons, Ads and Enterprises can be from any city. But, when I access an enterprise for example, I got this URL: https://localhost/site/enterprises/post-name. Ok but. The Loop of this page, should know that the user is at the city he choose before in the select.

    I thought to use JS/HTML5 LocalStorage to set two values, then return them into PHP. But seems not possible.

    localStorage.setItem(‘state’,’value’);
    localStorage.setItem(‘city’,’value’);
    So in the loop of Coupons / Ads / Enterprise, I could use these values to make de wp-query.

    What I need is:

    A way using sessions, cookies, localstorage or anything to “record” the state/city values and pass them to the queries. And if user changes city, theses values also changes.

    Any ideas? Thanks!

  • The topic ‘WordPress URL – Sessions, Cookies or GET using different Custom Post Types’ is closed to new replies.