Created
March 14, 2013 20:54
-
-
Save blobaugh/5165152 to your computer and use it in GitHub Desktop.
options.php in plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A unique identifier is defined to store the options in the database and reference them from the theme. | |
* By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed. | |
* If the identifier changes, it'll appear as if the options have been reset. | |
* | |
*/ | |
function optionsframework_option_name() { | |
// This gets the theme name from the stylesheet (lowercase and without spaces) | |
$themename = get_option( 'stylesheet' ); | |
$themename = preg_replace("/\W/", "_", strtolower($themename) ); | |
$optionsframework_settings = get_option('optionsframework'); | |
$optionsframework_settings['id'] = $themename; | |
update_option('optionsframework', $optionsframework_settings); | |
// echo $themename; | |
} | |
/** | |
* Defines an array of options that will be used to generate the settings page and be saved in the database. | |
* When creating the 'id' fields, make sure to use all lowercase and no spaces. | |
* | |
*/ | |
function optionsframework_options() { | |
$options = array(); | |
$options = apply_filters( 'wot_options_page', $options ); | |
//echo '<pre>'; var_dump($options); echo '</pre>'; | |
return $options; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment