Hi,
is_search
is the function you’re looking for (codex: https://codex.wordpress.org/Function_Reference/is_search). You can add:
is_search() ||
to the beginning of the logic you have added previously, it then reads: “if we’re on search result pages OR –condition set previously– then show the menu item.”
perfect, it works.
i have more tnah one search menu, can i add a ID in “is_search() ||” ?
for example in balances my search is ” aws_search_form id=”2″ ”
best regards
Not really sure what “aws_search_form” is, is that sent via GET (you could see it in the browser address bar)? If so you could do:
( is_search() && isset( $_GET['aws_search_form'] ) && $_GET['aws_search_form'] == 2 ) ||
So now it reads: if we’re on search results page AND “aws_search_form” sent via GET is set to 2, OR –whatever comes next– then show the menu.
thanks for your replay
my address bar in search result page is : http://www.optika-italy.com/?s=series&post_type=product&type_aws=true&id=2&filter=1
so i changed your code in : ( is_search() && isset( $_GET[‘id’] ) && $_GET[‘id’] == 2 ) ||
right?
thanks a lot for your help
best regards
From what you have there, we could infer:
( is_search() && isset( $_GET['type_aws'] ) && isset( $_GET['id'] ) $_GET['id'] === 2 ) ||