<?php
define('TS_THEMENAME', 'videofly');

/**
 * Alert require plugins
 */
require( get_template_directory() . '/required-plugins/class-tgm.php' );

/**
 * Include to search tags and custom posts
 */
require( get_template_directory() . '/includes/include-to-search.php' );

/**
 * Importer video extern
 */
require( get_template_directory() . '/includes/importer-video.php' );

/**
 * Code frontend submision
 */
require( get_template_directory() . '/includes/frontend-submision.php' );

/**
 * Functions
 */
require( get_template_directory() . '/includes/functions.php' );

/**
 * Define custom constants, image sizes, nav menus...
 */
require( get_template_directory() . '/includes/theme-setup.php' );

/**
 * Import demo data
 */
require( get_template_directory() . '/import/ts-importer.php' );

/**
 * Layout Compilator
 */
require( get_template_directory() . '/includes/layout-compilator.php' );

/**
 * Dynamic included CSS and JavaScript
 */
require( get_template_directory() . '/includes/dynamic-css-and-js.php' );

/**
 * Include the Tabber Functions File
 */
require( get_template_directory() . '/includes/widgets/tabber.php' );

/**
 * Include the Most liked Functions File
 */
require( get_template_directory() . '/includes/widgets/most-liked.php' );

/**
 * Include the Most liked Functions File
 */
require( get_template_directory() . '/includes/widgets/popular.php' );

/**
 * Include the Most liked Functions File
 */
require( get_template_directory() . '/includes/widgets/list-events.php' );

/**
 * Include the Most liked Functions File
 */
require( get_template_directory() . '/includes/widgets/most-viewed.php' );

/**
 * Dynamic sidebars
 */
require( get_template_directory() . '/includes/dynamic-sidebars.php' );

/**
 * Likes system
 */
require( get_template_directory() . '/includes/TouchSizeLikes.php' );

/**
 * Layout builder elements
 */
require( get_template_directory() . '/includes/layout-builder/classes/element.php' );

/**
 * Layout builder templates
 */
require( get_template_directory() . '/includes/layout-builder/classes/template.php' );

/**
 * Options megamenu
 */
require( get_template_directory() . '/includes/megamenu/ts-megamenu.php' );
require( get_template_directory() . '/includes/megamenu/class-megamenu.php' );


/**
 * Include Theme options
 */
require( get_template_directory() . '/includes/options.php' );

/**
 * Include Class Typography
 */
require( get_template_directory() . '/includes/class-typography.php' );
new videofly_Google_Fonts();


/**
 * Ajax
 */
require( get_template_directory() . '/includes/ajax.php' );

/**
 * Custom posts and Metadata
 */
require( get_template_directory() . '/includes/custom-posts.php' );

/**
 * Aqua resizer
 */
require( get_template_directory() . '/includes/aq_resizer.php' );

/**
 * Fields Class
 */
require( get_template_directory() . '/includes/fields.class.php' );

/**
 * Attached images manager
 */
require( get_template_directory() . '/includes/attached_images_manager.php' );

/**
 * Attached images manager
 */
require( get_template_directory() . '/includes/ts-shortcode/TsShortcode.php' );

/**
 * Include for the widgets
 */

require( get_template_directory() . '/includes/widgets/tweets.php' );
require( get_template_directory() . '/includes/widgets/flickr.php' );
require( get_template_directory() . '/includes/widgets/instagram.php' );
require( get_template_directory() . '/includes/widgets/tags.php' );
require( get_template_directory() . '/includes/widgets/custom_post.php' );
require( get_template_directory() . '/includes/widgets/comments.php' );
require( get_template_directory() . '/includes/widgets/latest_posts.php' );
require( get_template_directory() . '/includes/widgets/facebook.php' );
require( get_template_directory() . '/includes/widgets/user.php' );

// Add ID and CLASS attributes to the first <ul> occurence in wp_page_menu
function add_menuclass( $ulclass ) {
	return preg_replace('/<div class="(.*)"><ul/im', '<div><ul class="$1"', $ulclass);
}
add_filter( 'wp_page_menu', 'add_menuclass' );

if ( ! isset( $content_width ) ) $content_width = 1340;

// Add WooCommerce Support for the theme
require( get_template_directory() . '/woocommerce/theme-woocommerce.php' );

if(current_theme_supports( 'ts_is_mega_menu' ) ) { new ts_is_megamenu(); }

?>