I have one php file in wordpress where have a php variable $tt->name
.
This $tt->name
I want to convert into a shortcode so I canuse it somewhere else on the website.
Let me explain step by step. First I have search where user choose taxonomy and then type in search box and click on search.
On search result page, taxonomy is as $tt->name
(Because there are 3-4 types of result, depend on what user choose, like if 1st taxonomy then another result and if 2nd taxonomy then a message, if 3rd taxonomy then a pic and so on..
But all on the top have line, "You have chosen taxonomy 1" and that 1 is $tt->name
in code actually. Now there is a form just in next with title, contact us and there is a field which I want value of $tt->name
. That's why I need shortcode. Because I want to use this shortcode somewhere else in the website.
Any solution for this?
Thanks
$tt->name
and where does it come from? Can you describe what the purpose of the shortcode is in non-technical terms? There's not a lot of context here to understand what's going ondo_shortcode
? Or do you have a custom search page template?search.php
for the template andpre_get_posts
to modify what gets searched?