Ehm, yea. I don't know what exactly your problem is, so some notes about the code below.
You should use the settings API. Here's a (new) tutorial by Chip Bennet. The way you're calling your currently set options (one get_option call per sub-array) you have about 11 db-calls only for your options. If you don't think about switching to the settings API, you should anyway only call get_option once, save it into some variable like $current_options = get_options('whatever');
and then go through it with $current_options['some_sub_arr'];
.
I try to not be harsh, so please don't get this in the wrong throught: The file is close to unreadable (for me). So many unnecassary tabs and line breaks. I hoped i could help, but i can't really help you with your specific problem.
Maybe it helps: There's a lot of other stuff i can say about this theme. I hope you can take some (positive) criticism (that helps making it better).
- As long as you don't want to use a $var inside a string you don't have to use double quotes
Example:
array( "key" => "value" )
could be written as array( 'key' => 'value' )
and will be much faster (meassured up to 5x faster).
- When using numerical index arrays, then you don't have to write
array( '0' => 'value' )
it's a numerical array per default if you don't specify a key.
- Never ever - really: never ever - use names for variables like
$options
when outside a class. Those will populate the global namespace and somewhen (surely) conflict with some other stuff
To handle names centrally (and not spread across all files like $options
):
$wpfolio_options_default = array ( '...' => '...' );
define ( 'WPFOLIO_OPTS', 'wpfolio_options_theme' );
// your global $var for theme users - do this only when you're really sure that nothing will change in there. Ever.
$wpfolio_options = get_option( WPFOLIO_OPTS );
function template_tag_whatever()
{
// If you're in the need to change the name of the options field in the DB, change it above in the define call
$all_options = get_option( WPFOLIO_OPTS );
// if you've made your options globaly available (if the behavior might change - themes may break, so do this with caution)
// global $wpfolio_options
// $background = $wpfolio_options['background_class'];
$background = $all_options['background_class'];
?>
<div class="<?php echo $background; ?>">
<!-- some stuff -->
</div>
<?php
}
// inside a template:
global $wpfolio_options;
if ( isset($wpfolio_options['portfolio_category']) )
{
echo $wpfolio_options['portfolio_category'];
}
But: It's still better - and much easier - to deal with the settings API. The above example was only mentioned to show you how much easier it is to handle names through Constants (see STYLESHEETPATH, etc.).