How to reset (clear) theme settings
I’ve found the solution, maybe it’ll be useful to anyone: function reset_mytheme_options() { remove_theme_mods(); } add_action( ‘after_switch_theme’, ‘reset_mytheme_options’ );
I’ve found the solution, maybe it’ll be useful to anyone: function reset_mytheme_options() { remove_theme_mods(); } add_action( ‘after_switch_theme’, ‘reset_mytheme_options’ );
Don’t forget the Option Framework Theme and Plugin. They are killer solutions IMO.
See TwentyEleven to get the idea: it uses register_default_headers() to add new header images. In your plugin or theme just add: add_action( ‘after_setup_theme’, ‘wpse_42529_add_header_images’ ); function wpse_42529_add_header_images() { register_default_headers( array( ‘a_short_name’ => array( ‘url’ => ‘%s/images/headers/a_short_name.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/a_short_name-thumbnail.jpg’, ‘description’ => __( ‘Wheel’, ‘twentyeleven’ ) ), ‘another_image’ => array( ‘url’ => ‘%s/images/headers/another_image.jpg’, ‘thumbnail_url’ => ‘%s/images/headers/another_image-thumbnail.jpg’, … Read more
Only allow site url in text field using wp_kses/wp_filter_nohtml_kses?
Create an Options page with two image upload fields
Apart from the isset issue, pointed by Rarst, there’s an error in the sanitization function. esc_attr seems not to work with radio buttons, using esc_sql does the job. You’re also missing the checked state for the buttons: add_filter( ‘admin_init’, ‘myservice_register_function’ ); function myservice_register_function() { register_setting( ‘general’, ‘my_service’, ‘esc_sql’ ); add_settings_field( ‘my_service’, ‘<label for=”service_need”>’.__(‘Do You need … Read more
I have found the solution that I was (sort of) looking for. I searched for a video tutorial to integrate my settings with the Theme Customization page, which does pretty much what I wanted it to, and I think might actually be more beneficial there.
Getting the ID of header image, even when set to random
Theme Customizier sanitize_callback not working
get option framework options returns Call to undefined function of_get_option()