开发者

How to have a text-only view of a WordPress website in addition to the fully themed view?

I have a client who is interested in having a text-only view of their website available to visitors with a开发者_如何转开发ccessibility needs. This would be in addition to the usual, fully themed view.

I like what the Kennedy Center did for text-only view, www.kennedy-center.org/text. I like how it appears to the user as a subdirectory, but I am trying to figure out how to accomplish that in WordPress. Two themes? Subdirectory? Session cookie? Intercepting the URL and loading different stylesheets?

Any suggestions or any built-in capability that anyone can suggest?

Thanks...

...Allen


A very fast way to go is to set a cookie and a GET variable.

Basic example:

In function.php:

if (isset($_GET['text'])) { 
    setcookie("is_text", 'true', time()+60*60*24*365*10,"/");
}

In header.php:

if (isset($_COOKIE['is_text'])||isset($_GET['text'])) {
 // text CSS stylesheet
} else {
 // standard CSS stylesheet
}

So you can switch the view in every page just by adding ?text to your url.


Try to use Theme Switcher plugin. See here for the demo: http://www.nkuttler.de/wordpress-plugin/theme-switch-and-preview-plugin/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜