<?php 
/*
 * Set up the content width value based on the theme's design.
 */
if ( ! function_exists( 'eminent_setup' ) ) :
function eminent_setup() {
	// This theme uses wp_nav_menu() in one locations.
	register_nav_menus( array(
		'primary'   => __( 'Main Menu', 'eminent' ),	
	) );
	global $eminent_content_width;
	if ( ! isset( $content_width ) ) $content_width = 900;
			/*
		 * Make eminent theme available for translation.
		 */
	load_theme_textdomain( 'eminent', get_template_directory() . '/languages' );
	// This theme styles the visual editor to resemble the theme style.
	add_editor_style(array('css/editor-style.css', eminent_font_url()));
	// Add RSS feed links to <head> for posts and comments.
	add_theme_support('automatic-feed-links');
	add_theme_support( 'title-tag' );
	add_theme_support('post-thumbnails');
	set_post_thumbnail_size( 770, 350, true );
	 add_image_size('eminent-blog-thumbnail-image', 770, 400, true);
	 add_image_size('eminent-blog-thumbnail-image-home', 370, 263, true);
	/*        
	* Switch default core markup for search form, comment form, and comments        
	* to output valid HTML5.        
	*/
	add_theme_support('html5', array(
		'search-form', 'comment-form', 'comment-list',
	));
	// Add support for featured content.
	add_theme_support('featured-content', array(
	   'featured_content_filter' => 'eminent_get_featured_posts',
	   'max_posts' => 6,
	));
	add_theme_support( 'custom-header', apply_filters( 'eminent_custom_header_args', array(
	'uploads'       => true,
	'flex-height'   => true,
	'default-text-color' => '#e36229',
	'header-text' => true,
	'height' => '120',
	'width'  => '1260'
 	) ) );
 	add_theme_support( 'custom-logo');

	add_theme_support( 'custom-background', apply_filters( 'eminent_custom_background_args', array(
	'default-color' => 'f5f5f5',
	) ) );
	// This theme uses its own gallery styles.       
	add_filter('use_default_gallery_style', '__return_false');
}
endif; // eminent_setup
add_action( 'after_setup_theme', 'eminent_setup' );


/***  excerpt Length ***/ 		
function eminent_change_excerpt_more( $eminent_more ) {
    return '<div class="theme-button  text-center"><a class="default-btn" href="'. get_permalink() . '" >'.__('READ MORE','eminent').'</a></div>';
}
add_filter('excerpt_more', 'eminent_change_excerpt_more');
function eminent_excerpt_length( $eminent_length ) {
    return 24;
}
add_filter( 'excerpt_length', 'eminent_excerpt_length', 999 );

add_action( 'admin_menu', 'eminent_admin_menu');
function eminent_admin_menu( ) {
    add_theme_page( __('Pro Feature','eminent'), __('Eminent Pro','eminent'), 'manage_options', 'eminent-pro-buynow', 'eminent_buy_now', 300 );   
}
function eminent_buy_now(){ ?>
<div class="eminent_pro_version">
  <a href="<?php echo esc_url('https://fruitthemes.com/wordpress-themes/eminentpro/'); ?>" target="_blank">
    <img src ="<?php echo esc_url(get_template_directory_uri()); ?>/images/eminent_pro_features.png" width="70%" height="auto" />    
  </a>
</div>
<?php
}
/* get in touch start */
require get_template_directory() . '/functions/getintouch.php';
/*** Enqueue css and js files ***/
require get_template_directory() . '/functions/enqueue-files.php';
/*** Theme Default Setup ***/
require get_template_directory() . '/functions/theme-default-setup.php';
/*** Breadcrumbs ***/
require get_template_directory() . '/functions/breadcrumbs.php';
/*** Custom Header ***/
require get_template_directory() . '/functions/custom-header.php';

/*** Customizer ***/
require get_template_directory() . '/functions/theme-customizer.php';
/*** Social Widget ***/
require get_template_directory() . '/functions/social-widget.php';