在 HREF 中的 URL 中间制作短代码回显
短代码 [mmjs-city] 与用户所在的城市相呼应。
我想创建一个链接,将用户带到结果页面,并将用户的城市作为搜索词。基本上,URL 应该是结果页面 URL + 短代码的结果(城市)。
我尝试这样写:
<a href="http://chusmix.com/?s=[mmjs-city]">Search for your city</a>
通常我只会使用 PHP 并将城市分配给一个值,但我所在的页面不是主题,并且 PHP 由于某种原因无法在页面上工作,很可能这是可能的,但我不这样做不知道怎么办。无论如何,有人知道我该怎么做吗?谢谢,圣诞快乐
The short code [mmjs-city] echoes the city the user is in.
I want to make a link that takes the user to a results page with the user's city as search term. Basically the URL should be the results page URL + the result of the shortcode (the city).
I tried to write it this way:
<a href="http://chusmix.com/?s=[mmjs-city]">Search for your city</a>
Normally I would just use PHP and assign the city to a value but I'm in a page not the theme and PHP doesn't work on pages for some reason, most likely It's possible but I don't know how. Anyway, anybody knows how could I do it? Thanks and merry christmas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在会话中存储城市简码。在结果页面中,阅读会话内容以获取城市简码并将其作为搜索词。
You can store city shortcode in session. In the result page, read session content to get city shortcode and make it to be a search term.