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.

2 Answers 2


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']; 
  • your comment says: 86400 = 1 day , and you multiply by 7, so you add 7days not one?
    – woony
    Aug 21, 2012 at 12:37
  • yeah a small typo. Thx Aug 21, 2012 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.

  • 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, 2012 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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