[theme-reviewers] Theme Options and Functions (Muhammad Khairul Syahir Abdul Hakim)

Satish Gandham satish.iitg at gmail.com
Wed Oct 20 21:16:37 UTC 2010


This is the code i used when i decided to use array for storing options in
my theme.
Code is self explanatory, feel free to contact me if you have any questions.

<?php
function on_theme_activation(){
    if ( get_option('swift_activation_check')!="set" ){
        //Checking if the user used the theme before
        //Pick some variable from your theme and see if its set
        if(get_option('swift_logo_url')){
        foreach ($swift_options as $value) {
                $swift_opt[$value['id']]=get_option($value['id']);
                 delete_option($value['id']);
                }
        update_option('swift_opt',$swift_opt);
        }
}
    // Add marker so it doesn't run in future
    update_option('swift_activation_check', "set");

}
add_action('admin_head', 'first_run_options');
?>


Satish Gandham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20101021/be4767e2/attachment.htm>


More information about the theme-reviewers mailing list