开发者

Add a query var at the end of WordPress url

i've been searching for two hours looking for this specific questions, but still no luck.

I am writing a simple plugin to switch themes on the fly.

So i would like to add a query_var at the end of the WordPress url.

From: http://somedomain.com/?p=1

To: http://somedomain.com/?p=1&theme=abcd

I would like to rewrite all url开发者_StackOverflow in that page to add &theme=abcd so my plugin will know which theme should be rendered.

I rather use query_var rather than store it in cookie.

Any help is really appreciated.

Thanks

Ivan


There are a number of plugins that do this already.

Here is a good place to start: http://codex.wordpress.org/Theme_Switching

Also, there is a relatively new stack exchange site specifically for Wordpress that questions like this should be asked.

https://wordpress.stackexchange.com/


$get = $_GET;

$get['theme'] = 'abcd';

$getSerialised = http_build_query($get);

$url = 'http://somedomain.com/?' . $getSerialised;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜