Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizer not change preview values #2053

Closed
biklik opened this issue Sep 24, 2016 · 7 comments
Closed

Customizer not change preview values #2053

biklik opened this issue Sep 24, 2016 · 7 comments
Labels
Projects

Comments

@biklik
Copy link

biklik commented Sep 24, 2016

I have this basic code (from the example) in my ../options/customizer.php file:

        'section_1' => array(
            'title' => __('Unyson Section #1', '{domain}'),
            'options' => array(

                'option_1' => array(
                    'type' => 'text',
                    'value' => 'Default Value',
                    'label' => __('Unyson Option #1', '{domain}'),
                    'desc' => __('Option Description', '{domain}'),
                ),

            ),
        ),

And to get the changed value, I use echo fw_get_db_customizer_option('option_1') but nothing change. Only when I click in the save button the value is changed.

Can you help me?

Thanks

@ghost ghost self-assigned this Sep 26, 2016
@ghost
Copy link

ghost commented Sep 26, 2016

Hello,

I added in {theme}/header.php

<?php fw_print(fw_get_db_customizer_option('option_1')); ?>

and it works.

@ghost ghost added the can't reproduce label Sep 26, 2016
@biklik
Copy link
Author

biklik commented Sep 26, 2016

I don't know if something is wrong in my project, but I'm having the problem yet.

You can see here...

@ghost
Copy link

ghost commented Sep 26, 2016

@biklik Can you send me your admin and ftp details to moldcraft[at]email.com ?

@biklik
Copy link
Author

biklik commented Sep 26, 2016

Ok!

@ghost
Copy link

ghost commented Sep 26, 2016

Thank you. Inspecting...

@ghost ghost closed this as completed in 281ed03 Sep 26, 2016
@ghost
Copy link

ghost commented Sep 26, 2016

I made the fix on your site. It will be included in next Unyson release.

How Customizer preview works: At some point, the get_theme_mod() result is replaced with data from $_POST.

The problem: You called fw_get_db_customizer_option() earlier than the replace happened, the value was cached, next time you call fw_get_db_customizer_option() (in header.php) the cached value is returned.

The fix: I reset the cache on customize_preview_init (when the customizer values replace happens).

@ghost ghost added bug and removed can't reproduce labels Sep 26, 2016
@biklik
Copy link
Author

biklik commented Sep 26, 2016

Thanks!!!! ;))

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

1 participant