即时选择主题并传递参数

时间:2016-07-30 10:37:13

标签: php wordpress

我的设计师给了我四个不同的模板,一个用于

mobile-index-page
mobile-searchresult-page
desktop-index-page
desktop-searchresult-page

我学会了如何在移动时切换主题,但是如何传递参数(通过GET)并选择搜索结果主题?

1 个答案:

答案 0 :(得分:0)

要传递参数,请在URL中对它们进行编码并通过$ _GET读取它们,只需将参数添加到网址

http://www.example.com/page.php?mobile=false

在页面上,您可以通过$_GET检查移动设备值并结束

if(isset($_GET['mobile']) && mobile==false){
//it's not mobile
}else{
//it's mobile
}