WordPress.org

Forums

Switching style sheets and accessibility (1 post)

  1. wingers57
    Member
    Posted 2 years ago #

    I have been working with WordPress for around 4 months. I have got to the stage where I can relatively easily modify child themes and create a customised look and feel for a client.
    Right now I am struggling with theme switching. In this case I have a standard "style.css" loaded and two alternate css themes available. The website has three buttons on it, one for normal, one for high contrast and one for medium contrast. (These are for people with visual disabilities) I can get the themes to switch ok on a page. When I view another page it switches back to the "normal" or default css. I use a cookie to set which Alt theme should be used. I can see that the cookie is correctly carrying one of three defined values and these values continue to be held after the page is changed or refreshed.

    The behaviour appears to be that while on a page the css can be switched on and off, the cookie is set with the appropriate value. When going to a new page via the menu the cookie should be read and the relevant selected style sheet turned on (or off). It is this part which is not working. I know the principle works ok because I have implemented it on a simple two page HTML site.

    I have inserted code into header.php for handling the cookies. The part that reads the cookie is at the top of the header.php after the <body> tag. My question is whether this is the right place or not. Does the header refresh each time a page changes? If it does not then that is why it is not working. Where else should I put the read cookie code?

    The site can be found here, it is very much work in progress:
    http://www.wingrove-media.com/suco2/

    Many thanks in advance for any help you may be able to provide.

Topic Closed

This topic has been closed to new replies.

About this Topic