Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Luke Janicke on "A reset button for a theme’s settings page"

$
0
0

Problem. I want to include a RESET button on a theme’s settings page. I don’t mean a button that just clears any changes just made on the form. I mean a button that resets all the theme’s settings to their defaults.

I’m putting together a theme settings page for the theme I’m developing. This is where a few theme options can be toggled on/off and some custom items set, such as the copyright notice and social media links. I’ve got it all working. The page is at: Dashboard > Appearance > Respite Settings. And all the settings are working correctly (saving properly, able to be used in the theme’s template files).

Note: Respite is the name of my theme.

I have a function in my options.php file that can do perform the settings reset. I just don’t know how to link a reset button on the options page form to that function. You can see my options.php file on Github.

https://github.com/lukejanicke/respite/blob/master/options.php

A quick search turned up a few StackExchange threads about doing this but none had enough information to help me actually do it.

Any help would be appreciated!


Viewing all articles
Browse latest Browse all 8245

Trending Articles