<?php
/*
 * Set up the content width value based on the theme's design.
 */
if ( ! function_exists( 'bizzbee_setup' ) ) :
function bizzbee_setup() {	
	
	register_nav_menus( array(
		'primary'   => __( 'Main Menu', 'bizzbee' ),	
	) );
	global $content_width;
	if ( ! isset( $content_width ) ) $content_width = 730;
	
	load_theme_textdomain( 'bizzbee', get_template_directory() . '/languages' );	
	add_theme_support('automatic-feed-links');
	add_theme_support('post-thumbnails');
	set_post_thumbnail_size(730, 404, true);
	add_image_size('bizzbee-post-image', 670, 380, true);
	add_image_size('bizzbee-home-tab-size', 380, 270, true);	
	add_image_size('bizzbee-custom-widget-size',100, 80, true);
	add_image_size('bizzbee-blog-thumbnail-image-home',570, 320, true);
	
	add_theme_support('html5', array(
	   'search-form', 'comment-form', 'comment-list',
	));
	add_theme_support( 'custom-header', apply_filters( 'bizzbee_custom_header_args', array(
	'uploads'       => true,
	'flex-height'   => true,
	'default-text-color' => '#000',
	'header-text' => true,
	'height' => '110',
	'width'  => '1300'
 	) ) );
	add_theme_support( 'custom-background', apply_filters( 'bizzbee_custom_background_args', array(
	'default-color' => 'f5f5f5',
	) ) );	
	add_theme_support( 'custom-logo', array(
		'width'       => 250,
		'height'      => 250,
		'flex-width'  => true,
		'flex-height' => true,
		'priority' => 11,
		 'header-text' => array('img-responsive-logo', 'site-description-logo'),
	) );
	add_filter('use_default_gallery_style', '__return_false'); 
	add_editor_style('css/editor-style.css');
	add_theme_support( 'title-tag' );	  	
}
function bizzbee_change_excerpt_more( $more ) {
	global $post;
    return '<div class="theme-btn-group col-md-12"><a class="default-btn" title="'. __('Read More','bizzbee').'" href="'. esc_url(get_permalink($post->ID)) . '">' .  __('Read More','bizzbee'). '</a></div>';          
}
add_filter('excerpt_more', 'bizzbee_change_excerpt_more');
function bizzbee_excerpt_length( $length ) {
    return (!is_page_template('page-templates/front-page.php')) ? 60 : 30;
}
add_filter( 'excerpt_length', 'bizzbee_excerpt_length', 999 );

endif; // bizzbee_setup
add_action( 'after_setup_theme', 'bizzbee_setup' );

add_action( 'admin_menu', 'bizzbee_admin_menu');
function bizzbee_admin_menu( ) {
    add_theme_page( __('Pro Feature','bizzbee'), __('Bizzbee Pro','bizzbee'), 'manage_options', 'bizzbee-pro-buynow', 'bizzbee_buy_now', 300 );   
}
function bizzbee_buy_now(){ ?>
<div class="bizzbee_pro_version">
  <a href="<?php echo esc_url('https://fruitthemes.com/wordpress-themes/bizzbeepro/'); ?>" target="_blank">
    <img src ="<?php echo esc_url(get_template_directory_uri()); ?>/images/bizzbee_pro_features.png" width="70%" height="auto" />    
  </a>
</div>
<?php
}

/*** Enqueue css and js files ***/
require get_template_directory() . '/functions/enqueue-files.php';
/*** Enqueue breadcrumbs files ***/
require get_template_directory() . '/functions/breadcrumbs.php';
/*** default setup files ***/
require get_template_directory() . '/functions/theme-default-setup.php';
/*** Customizer ***/
require get_template_directory() . '/functions/theme-customizer.php';
require get_template_directory() . '/functions/custom-header.php';