Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have been attempting to create a theme reset button for the theme customizer that automatically removes all of the theme_mod settings. I have tried multiple ways to do this and have never been able to get it to work. As seen here.

After multiple failed attempts using the remove_theme_mods approach I begin to wonder if that is my problem other than the ajax and javascript being faulty and not properly binding the button.

Since I save all defaults into one big array so when my theme is installed it automatically has values populated on the theme customizer page, and the theme has a specific look... I was thinking I could try a different approach to instead remove the theme settings I just over ride them, maybe with a custom control? Possibly by somehow assigning these default values to all settings? I really hope someone can help me get this going. If you have any ideas I would appreciate it very very much.

Here is an example of how I assign the default values for the theme:

function newtheme_get_theme_mods() {

$defaults = array(

        'newtheme_responsive'                 => true,

        'newtheme_hero_title'                 => 'Beautiful and Elegant',

        'newtheme_hero_description'           => 'The best theme in the world',

                'newtheme_header_logo'                => '/wp-content/themes/newtheme/img/logo.png',

                'newtheme_header_background_color'    => 'rgba(35,35,35, 0.9)'


    return $defaults;

}
share|improve this question
add comment

1 Answer

So in your theme setting page do something like this:

if( isset( $_REQUEST['resetl_all'] ) ){
    call_reset_function(); // or newtheme_get_theme_mods function (I guess)                      
}
share|improve this answer
    
Thank you for the suggestion. I attempted to change the remove theme mods to your suggestion of the function that returns the defaults, and I still am having the same issue. So I am starting to think that maybe the issue really is that the button isn't binding to the function properly. I still can not get it to bind properly so I think I am just going to give up on this feature all together. –  user1632018 May 16 '13 at 20:45
    
try to print something when button pressed lilke if(isset($_REQUEST['button_name'])){echo 'button clicked';} –  Noor Ahmad Feroozi May 17 '13 at 9:48
add comment

Your Answer

 
discard

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.