Passing URL variables
-
Hi!
Sorry to ask that, because it seems it has been solved in some way, but the passing variables through URL is driving me cray.
I just want to display some products based on which link has the user clicked. To do that, I want to pass a parameter called “theme”, so the URL query gets like that:
https://www.ticsipaisatge.cat/?page_id=604?tema=Platoniq
I’ve made a new function on my functions.php like this:
function add_query_vars($aVars) { $aVars[] = "theme"; // represents the name of the theme return $aVars; } add_filter('query_vars', 'add_query_vars');
And I’m trying to retrieve it by doing this on the end page:
if(isset($wp_query->query_vars['theme'])) { $theme = urldecode($wp_query->query_vars['theme']); } echo $theme;
But nothing is “echoed”. I feel like I’m doing everything ok but I’m missing something. Any help?
Thank you in advance,
Hector
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Passing URL variables’ is closed to new replies.