/** * Theme sprecific functions and definitions */ /* Theme setup section ------------------------------------------------------------------- */ // Set the content width based on the theme's design and stylesheet. if ( ! isset( $content_width ) ) $content_width = 1170; /* pixels */ // Add theme specific actions and filters // Attention! Function were add theme specific actions and filters handlers must have priority 1 if ( !function_exists( 'jarvis_theme_setup' ) ) { add_action( 'jarvis_action_before_init_theme', 'jarvis_theme_setup', 1 ); function jarvis_theme_setup() { // Register theme menus add_filter( 'jarvis_filter_add_theme_menus', 'jarvis_add_theme_menus' ); // Register theme sidebars add_filter( 'jarvis_filter_add_theme_sidebars', 'jarvis_add_theme_sidebars' ); // Set options for importer add_filter( 'jarvis_filter_importer_options', 'jarvis_set_importer_options' ); // Set list of the theme required plugins jarvis_storage_set('required_plugins', array( 'essgrids', 'instagram_feed', 'instagram_widget', 'revslider', 'tribe_events', 'trx_utils', 'visual_composer', 'content_timeline', 'woocommerce' ) ); } } // Add/Remove theme nav menus if ( !function_exists( 'jarvis_add_theme_menus' ) ) { //add_filter( 'jarvis_filter_add_theme_menus', 'jarvis_add_theme_menus' ); function jarvis_add_theme_menus($menus) { return $menus; } } // Add theme specific widgetized areas if ( !function_exists( 'jarvis_add_theme_sidebars' ) ) { //add_filter( 'jarvis_filter_add_theme_sidebars', 'jarvis_add_theme_sidebars' ); function jarvis_add_theme_sidebars($sidebars=array()) { if (is_array($sidebars)) { $theme_sidebars = array( 'sidebar_main' => esc_html__( 'Main Sidebar', 'jarvis' ), 'sidebar_footer' => esc_html__( 'Footer Sidebar', 'jarvis' ) ); if (function_exists('jarvis_exists_woocommerce') && jarvis_exists_woocommerce()) { $theme_sidebars['sidebar_cart'] = esc_html__( 'WooCommerce Cart Sidebar', 'jarvis' ); } $sidebars = array_merge($theme_sidebars, $sidebars); } return $sidebars; } } // Set theme specific importer options if ( !function_exists( 'jarvis_set_importer_options' ) ) { //add_filter( 'jarvis_filter_importer_options', 'jarvis_set_importer_options' ); function jarvis_set_importer_options($options=array()) { if (is_array($options)) { $options['debug'] = jarvis_get_theme_option('debug_mode')=='yes'; $options['domain_dev'] = 'jarvis.dv.ancorathemes.com'; $options['domain_demo'] = 'jarvis.ancorathemes.com'; $options['menus'] = array( 'menu-main' => esc_html__('Main menu', 'jarvis'), 'menu-user' => esc_html__('User menu', 'jarvis'), 'menu-footer' => esc_html__('Footer menu', 'jarvis'), 'menu-outer' => esc_html__('Main menu', 'jarvis') ); } return $options; } } /*+ Special the image size for events */ add_image_size('jarvis-single-event', 380, 470, true); //*+ Add custom body class to the head add_filter( 'body_class', 'jarvis_body_class' ); function jarvis_body_class( $classes ) { $theme_skin = jarvis_esc(jarvis_get_custom_option('theme_skin')); $blog_style = jarvis_get_custom_option(is_singular() && !jarvis_storage_get('blog_streampage') ? 'single_style' : 'blog_style'); $body_style = jarvis_get_custom_option('body_style'); $article_style = jarvis_get_custom_option('article_style'); $top_panel_position = jarvis_get_custom_option('top_panel_position'); $need_collapse_menu = jarvis_get_custom_option('need_collapse_menu'); $video_bg_show = jarvis_get_custom_option('show_video_bg')=='yes' && (jarvis_get_custom_option('video_bg_youtube_code')!='' || jarvis_get_custom_option('video_bg_url')!=''); $classes[] .= 'jarvis_body body_style_' . esc_attr($body_style) . ' body_' . (jarvis_get_custom_option('body_filled')=='yes' ? 'filled' : 'transparent') . ' theme_skin_' . esc_attr($theme_skin) . ' article_style_' . esc_attr($article_style) . ' layout_' . esc_attr($blog_style) . ' template_' . esc_attr(jarvis_get_template_name($blog_style)) . (!jarvis_param_is_off($need_collapse_menu) ? ' need_collapse_menu ' : '') . (!jarvis_param_is_off($top_panel_position) ? ' top_panel_show top_panel_' . esc_attr($top_panel_position) : 'top_panel_hide') . ' ' . esc_attr(jarvis_get_sidebar_class()) . ($video_bg_show ? ' video_bg_show' : '') . (jarvis_get_theme_option('page_preloader')!='' ? ' preloader' : ''); return $classes; } /* Include framework core files ------------------------------------------------------------------- */ // If now is WP Heartbeat call - skip loading theme core files require_once get_template_directory().'/fw/loader.php'; ?>