Skip to content

Commit

Permalink
Parse in default theme options in thematic_get_theme_opt()
Browse files Browse the repository at this point in the history
Use wp_parse_args() to use default theme options even when no
options have been saved to the database yet.

See #110
  • Loading branch information
middlesister committed Jul 26, 2014
1 parent f1288ce commit 5a43b80
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions library/extensions/theme-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,18 @@ function thematic_get_wp_opt( $option_name, $default = false ) {
*/
function thematic_get_theme_opt( $opt_key, $echo = false ) {

$theme_opt = thematic_get_wp_opt( 'thematic_theme_opt' );
$theme_opt = wp_parse_args( thematic_get_wp_opt( 'thematic_theme_opt', array() ), thematic_default_opt() );

if ( isset( $theme_opt[$opt_key] ) ) {
if ( false === $echo ) {
return $theme_opt[$opt_key] ;
} else {
echo $theme_opt[$opt_key];
}
} else {
if ( !isset( $theme_opt[$opt_key] ) ) {
return false;
}

if ( false === $echo ) {
return $theme_opt[$opt_key];
} else {
echo $theme_opt[$opt_key];
}

}


Expand Down

0 comments on commit 5a43b80

Please sign in to comment.