WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create font size and background change buttons, which i know how to do it. The problem is with remember it, so if user will go to a different page, background and font will stay the same. How can i do it?

I was thinking about saving this in cookies. What do you think about that?

Is anyone can write an example of saving valible in cookies in wordpress.

share|improve this question
up vote 1 down vote accepted

Here is how you can sett a cookie whit a variable: Now it saves for one day.

$settings = $mybackground;
setcookie('background',$settings,time() + (86400)); // 86400 = 1 day

Print it in the body like an img whit this:

echo $_COOKIE['background']; 
share|improve this answer
your comment says: 86400 = 1 day , and you multiply by 7, so you add 7days not one? – woony Aug 21 '12 at 12:37
yeah a small typo. Thx – Pontus Abrahamsson Aug 21 '12 at 12:59

You can use this plugin for the font: http://wordpress.org/extend/plugins/font-resizer/

Description of the plugin:

This plugin allows you to give the visitors of your site the option to change the font size. The plugin acts over jQuery and saves the settings in a cookie. So the visitor see the same font size if they revisit your site. Which content is going resized, the resize steps and other options you can set on the admin page called "font-resizer".

It should be a start to get the background to changa also, just look how the font changes.

share|improve this answer
Thanks, but I need example of saving varible in cookies. If I would know that, I could save font, background etc. I know how to change iton website with jquery. – miszczu Jul 2 '12 at 9:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.