Theme Customizer changes are dissappearing when change page

With @Otto’s tips, i found the problem.

I was calling theme settings in functions.php and was calling settings as global variable in theme files. This was working properly except temporary changes was disappearing in theme customizer’s live edit when you change page with clicking links.

After this experience, what i am suggesting:

If you have some functions need to run for theme settings like this one for example:

$anatema_settings = get_option( 'anatema_settings' ); // site options
switch ($anatema_settings["layout"]) {
    case 'only-content':
        $anatema_layout["primary_class"] = "span8";
        $anatema_layout["primary_fullwidth_class"] = "span8";
        $anatema_layout["secondary_class"] = "hide";        
        $anatema_layout["container_class"] = "container";       
        $anatema_layout["page_class"] = "site-narrow";      
      break;
    case 'sidebar-content':
        $anatema_layout["primary_class"] = "span8 pull-right";
        $anatema_layout["primary_fullwidth_class"] = "span12";
        $anatema_layout["secondary_class"] = "span4";       
        $anatema_layout["container_class"] = "container";       
         break;
    default:
    case 'content-sidebar':
        $anatema_layout["primary_class"] = "span8";
        $anatema_layout["primary_fullwidth_class"] = "span12";
        $anatema_layout["secondary_class"] = "span4";       
        $anatema_layout["container_class"] = "container";       
       break;   
}

Create a new file and include it to every theme file that need those theme options. Update: Call it in customize_preview_init action like:

add_action( 'customize_preview_init', "firmasite_customizer_preview_init");
function firmasite_customizer_preview_init() {
    include ( get_template_directory() . '/functions/customizer-call.php');         // Customizer functions 
}