Select Category Before Search

This topic contains 4 replies, has 2 voices, and was last updated by  Paolo 8 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #224061

    smallgeek
    Full Member
    Post count: 64

    Hi:

    I want to have my users to choose their category before searching the listings. I have 12 CPTs and am using Supreme theme.

    This is how I think I can do it:

    * Use the CPT Places as a place holder and change all the labels to “Select Category”.
    * Make Places my first CPT in the CPT section of the search widget.
    * Have 1 dummy listing to prop open the Places CPT in the CPT list in the search widget.
    * Hide all other instances of the Places CPT in other widgets, etc.

    Now my users see the words “Select Category” in the CPT dropdown. I hope they select a category and proceed as normal through the site.

    If someone doesn’t select a category and does attempt to search in the Places CPT they would end up seeing my dummy listing. Which I don’t want.

    What I do want is for them to be redirected to a page called /pick-a-category/. I can use this page to show them the category options AGAIN and redirect them to a real CPT. This page just became a feature 🙂

    After trying to do 301 redirect and using an url masking plugin I realize I have to do a RewriteRule. I don’t actually know how to do this but I am Googling and reading as fast as I can. I am using the ReDirection plugin until I get the code correct then I will put it into the .htaccess and disable the plugin.

    Any reason this wouldn’t work?

    And any chance you have the rewrite code hanging around for this string that would allow me to do the rewrite to go to my preferred page?

    ?geodir_search=1&stype=gd_place&s=+&snear=&sgeo_lat=&sgeo_lon=

    thx

    #224136

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    it should work, for the redirect, did you try this? https://wordpress.org/plugins/quick-pagepost-redirect-plugin/

    Let us know,

    Thanks

    #224557

    smallgeek
    Full Member
    Post count: 64

    I have not used this plugin. I just had a quick look at it and I am guessing you suggested it because it handles jQuery. And it should be able to redirect URLs that start with a ?. Things just became a little clearer for me. Thank you.

    I will report back my findings.

    #227734

    smallgeek
    Full Member
    Post count: 64

    Yeah, baby it can be done. Once you learn how to do it.

    I used the Redirection plugin (http://urbangiraffe.com/plugins/redirection/) using the Regex feature.

    My issue was the leading ? in /?geodir_search=1&stype=gd_place&s… was buggering things up and leading me to 404 pages and all sorts of wonky stuff.

    Once I used the wildcard (.) in place of the ? in /(.)geodir_search=1&stype=gd_place&s… everything worked a treat.

    I just kept entering searches and redirecting them until everything finally went to my /pick-a-category/ page.

    Look at attached image to see what I did.

    #228231

    Paolo
    Site Admin
    Post count: 31206

    Thanks for sharing 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount