Custom Query Var handling (3 posts)

  1. adhardwick
    Posted 4 years ago #

    I am using google Adsense for search.
    On form submit the action adds a query var string that starts with "?cx="

    I want that action to be handled by a file in theme called results.php (instead of search.php or the fallback index.php). Does anyone know how this can be done?

    Maybe a filter to add cx to query vars and the a filter to define is_results function?

  2. Mark / t31os

    Posted 4 years ago #

    Run a filter on template_include, check for your query var, if it's present, switch the template to your custom one.

    Dump the passed variable inside a callback on that filter before returning it and you'll see what i mean(assuming you know the basics of how filters work).. ;)

    You can see the filter in source here, incase it helps.

  3. adhardwick
    Posted 4 years ago #

    Thanks Mark,

    That's the file I had been scrutinizing. Just taking the week of for vacation.

Topic Closed

This topic has been closed to new replies.

About this Topic