<?php
/**
 * Default theme options.
 *
 * @package Memory Blog
 */

if ( ! function_exists( 'memory_blog_get_default_theme_options' ) ) :

	/**
	 * Get default theme options.
	 *
	 * @since 1.0.0
	 *
	 * @return array Default theme options.
	 */
function memory_blog_get_default_theme_options() {

	$defaults = array();

    // Front Page Content
	$defaults['enable_frontpage_content'] 				= true;

	// Slider Section	
	$defaults['enable_featured_slider_section']		    	= true;
	$defaults['number_of_featured_slider_items']	    	= 5;
	$defaults['featured_slider_content_type']		    	= 'featured_slider_post';

	// Latest Recipe Section
	$defaults['enable_latest_recipe_section']			= true;
	$defaults['latest_recipe_section_title']	    	= esc_html__( 'Latest Recipe', 'memory-blog' );
	$defaults['latest_recipe_category']	   	    		= 0; 
	$defaults['latest_recipe_number']					= 12;

	// Featured Posts Section	
	$defaults['enable_featured_posts_section']				= true;
	$defaults['featured_posts_background_color'] 	    	= '#FBF8F5';
	$defaults['featured_posts_section_title']				= esc_html__( 'Feature Posts', 'memory-blog' );
	$defaults['featured_posts_number']						= 6;
	$defaults['featured_posts_category']					= 0;

	// Theme Options
	$defaults['layout_options_blog']					= 'right-sidebar';
	$defaults['layout_options_archive']					= 'right-sidebar';
	$defaults['layout_options_page']					= 'no-sidebar';	
	$defaults['layout_options_single']					= 'right-sidebar';	
	$defaults['excerpt_length']							= 8;
	$defaults['your_latest_posts_title']				= esc_html__('Blog','memory-blog');

	//Footer section 		
	$defaults['copyright_text']							= esc_html__( 'Copyright &copy; All rights reserved.', 'memory-blog' );

	// Pass through filter.
	$defaults = apply_filters( 'memory_blog_filter_default_theme_options', $defaults );
	return $defaults;
}

endif;

/**
*  Get theme options
*/
if ( ! function_exists( 'memory_blog_get_option' ) ) :

	/**
	 * Get theme option
	 *
	 * @since 1.0.0
	 *
	 * @param string $key Option key.
	 * @return mixed Option value.
	 */
	function memory_blog_get_option( $key ) {

		$default_options = memory_blog_get_default_theme_options();
		if ( empty( $key ) ) {
			return;
		}

		$theme_options = (array)get_theme_mod( 'theme_options' );
		$theme_options = wp_parse_args( $theme_options, $default_options );

		$value = null;

		if ( isset( $theme_options[ $key ] ) ) {
			$value = $theme_options[ $key ];
		}

		return $value;

	}

endif;