<?php
/**
 * Returns theme options
 *
 * Uses sane defaults in case the user has not configured any theme options yet.
 *
 * @package businessPersonal
 */


/**
 * Returns the default settings of the theme
 *
 * @return array
 */
function businesspersonal_default_options() {

	$default_options = 
					array(
						'layout' 							=> 'right-sidebar',
						'post_content' 						=> 'excerpt',
						'excerpt_length' 					=> 30,
						'post_thumbnail_archives'			=> true,
						'post_thumbnail_single'				=> true,
						'meta_date'							=> true,
						'meta_author'						=> true,
						'meta_category'						=> true,
						'meta_comments'						=> false,
						'meta_tags'							=> true,
						'option' 							=> 1,
						'display_option' 					=> 'home',
						'cat' 								=> 1,
						'no' 								=> 3,
						'slider_control' 					=> true,
						'slider_effect' 					=> 'fade',
						'exc_blog'							=> 0 
					);
	
	return $default_options;
}

/**
 * Get saved user settings from database or theme defaults
 *
 * @return array
 */
function businesspersonal_theme_options() {
    $theme_options = get_option( 'businesspersonal_theme_options', array() );
	// Merge Theme Options Array from Database with Default Options Array
	$defaults =	businesspersonal_default_options(); 

	if ( isset( $theme_options ) && is_array( $theme_options ) )
	{
		$theme_options = array_replace( 
			
			// Get saved theme options from WP database
			$defaults,
			$theme_options 
			// Merge with Default Options if setting was not saved yet
		);
	}
	// Return theme options
	return $theme_options;	
}

