get( 'Version' )); add_action('after_setup_theme', 'enwoo_setup'); if (!function_exists('enwoo_setup')) : /** * Global functions */ function enwoo_setup() { // Theme lang. load_theme_textdomain('enwoo', get_template_directory() . '/languages'); // Add Title Tag Support. add_theme_support('title-tag'); $menus = array('main_menu' => esc_html__('Main Menu', 'enwoo')); if (class_exists('WooCommerce') && get_theme_mod('header_layout', 'woonav') == 'woonav') { $woo_menus = array( 'main_menu_right' => esc_html__('Menu Right', 'enwoo'), 'main_menu_cats' => esc_html__('Categories Menu', 'enwoo'), ); } else { $woo_menus = array(); // not displayed if Woo not installed } $all_menus = array_merge($menus, $woo_menus); // Register Menus. register_nav_menus($all_menus); add_theme_support('post-thumbnails'); set_post_thumbnail_size(300, 300, true); add_image_size('enwoo-img', 1140, 540, true); // Add Custom Background Support. $args = array( 'default-color' => 'ffffff', ); add_theme_support('custom-background', $args); add_theme_support('custom-logo', array( 'height' => 60, 'width' => 200, 'flex-height' => true, 'flex-width' => true, 'header-text' => array('site-title', 'site-description'), )); // Adds RSS feed links to for posts and comments. add_theme_support('automatic-feed-links'); /* * Let WordPress manage the document title. */ add_theme_support('title-tag'); // Set the default content width. $GLOBALS['content_width'] = 1140; add_theme_support('custom-header', apply_filters('enwoo_custom_header_args', array( 'width' => 2000, 'height' => 200, 'default-text-color' => '', 'wp-head-callback' => 'enwoo_header_style', ))); // WooCommerce support. add_theme_support('woocommerce'); add_theme_support('wc-product-gallery-zoom'); add_theme_support('wc-product-gallery-lightbox'); add_theme_support('wc-product-gallery-slider'); add_theme_support('html5', array('search-form')); add_theme_support('align-wide'); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ add_editor_style(array('css/bootstrap.css', enwoo_fonts_url(), 'css/editor-style.css')); } endif; if (!function_exists('enwoo_header_style')) : /** * Styles the header image and text displayed on the blog. */ function enwoo_header_style() { $header_image = get_header_image(); $header_text_color = get_header_textcolor(); if (get_theme_support('custom-header', 'default-text-color') !== $header_text_color || !empty($header_image)) { ?> ' . "\n", esc_url(get_bloginfo('pingback_url'))); } } add_action('wp_head', 'enwoo_pingback_header'); /** * Set Content Width */ function enwoo_content_width() { $content_width = $GLOBALS['content_width']; if (is_active_sidebar('enwoo-right-sidebar')) { $content_width = 847; } else { $content_width = 1140; } /** * Filter content width of the theme. */ $GLOBALS['content_width'] = apply_filters('enwoo_content_width', $content_width); } add_action('template_redirect', 'enwoo_content_width', 0); /** * Register custom fonts. */ function enwoo_fonts_url() { $fonts_url = ''; /** * Translators: If there are characters in your language that are not * supported by Lato, translate this to 'off'. Do not translate * into your own language. */ $font = get_theme_mod('main_typographydesktop', ''); if ('' == $font) { $font_families = array(); $font_families[] = 'Lato:300,400,700'; $query_args = array( 'family' => urlencode(implode('|', $font_families)), 'subset' => urlencode('cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese'), ); $fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css'); } return esc_url_raw($fonts_url); } /** * Add preconnect for Google Fonts. */ function enwoo_resource_hints($urls, $relation_type) { if (wp_style_is('enwoo-fonts', 'queue') && 'preconnect' === $relation_type) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } return $urls; } add_filter('wp_resource_hints', 'enwoo_resource_hints', 10, 2); /** * Enqueue Styles (normal style.css and bootstrap.css) */ function enwoo_theme_stylesheets() { // Add custom fonts, used in the main stylesheet. wp_enqueue_style('enwoo-fonts', enwoo_fonts_url(), array(), null); wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '3.3.7'); wp_enqueue_style('mmenu-light', get_template_directory_uri() . '/css/mmenu-light.min.css', array(), ENWOO_VERSION); // Theme stylesheet. wp_enqueue_style('enwoo-stylesheet', get_stylesheet_uri(), array('bootstrap'), ENWOO_VERSION); // WooCommerce stylesheet. if (class_exists('WooCommerce')) { wp_enqueue_style('enwoo-woo-stylesheet', get_template_directory_uri() . '/css/woocommerce.css', array('enwoo-stylesheet', 'woocommerce-general'), ENWOO_VERSION); } // Load Line Awesome css. wp_enqueue_style('line-awesome', get_template_directory_uri() . '/css/line-awesome.min.css', array(), '1.3.0'); } add_action('wp_enqueue_scripts', 'enwoo_theme_stylesheets'); /** * Register jquery */ function enwoo_theme_js() { wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.7', true); wp_enqueue_script('enwoo-theme-js', get_template_directory_uri() . '/js/customscript.js', array('jquery'), ENWOO_VERSION, true); wp_enqueue_script('mmenu', get_template_directory_uri() . '/js/mmenu-light.min.js', array('jquery'), ENWOO_VERSION, true); } add_action('wp_enqueue_scripts', 'enwoo_theme_js'); if (!function_exists('enwoo_is_pro_activated')) { /** * Query Enwoo activation */ function enwoo_is_pro_activated() { return defined('ENWOO_PRO_CURRENT_VERSION') ? true : false; } } if ( !function_exists( 'envo_extra_is_activated' ) ) { /** * Query Enwoo extra activation */ function envo_extra_is_activated() { return defined( 'ENVO_EXTRA_CURRENT_VERSION' ) ? true : false; } } if (!function_exists('enwoo_title_logo')) { add_action('enwoo_header_woo', 'enwoo_title_logo', 10); add_action('enwoo_header_bus', 'enwoo_title_logo', 10); /** * Title, logo code */ function enwoo_title_logo() { ?>
'; } add_action('enwoo_header_bus', 'enwoo_head_end', 80); add_action('enwoo_header_woo', 'enwoo_head_end', 80); function enwoo_head_end() { echo ''; } if (!function_exists('enwoo_menu_button')) { add_action('enwoo_header_woo', 'enwoo_menu_button', 28); add_action('enwoo_header_bus', 'enwoo_menu_button', 28); /** * Mobile menu button */ function enwoo_menu_button() { ?> esc_html__('Sidebar', 'enwoo'), 'id' => 'enwoo-right-sidebar', 'before_widget' => '', 'before_title' => '', ) ); register_sidebar( array( 'name' => esc_html__('Top Bar Section', 'enwoo'), 'id' => 'enwoo-top-bar-area', 'before_widget' => '', 'before_title' => '', ) ); if (get_theme_mod( 'header_layout', (class_exists('WooCommerce') ? 'woonav' : 'busnav') ) != 'busnav') { register_sidebar( array( 'name' => esc_html__('Header Section', 'enwoo'), 'id' => 'enwoo-header-area', 'before_widget' => '', 'before_title' => '', ) ); } register_sidebar( array( 'name' => esc_html__('Footer Section', 'enwoo'), 'id' => 'enwoo-footer-area', 'before_widget' => '', 'before_title' => '', ) ); } /** * Set the content width based on enabled sidebar */ function enwoo_main_content_width_columns() { $columns = '12'; $hide_sidebar = get_post_meta( get_the_ID(), 'envo_extra_hide_sidebar', true ); if (is_active_sidebar('enwoo-right-sidebar') && is_singular() && $hide_sidebar == 'on' ) { $columns = '12'; } elseif (is_active_sidebar('enwoo-right-sidebar')) { $columns = $columns - 3; } echo absint($columns); } if (!function_exists('enwoo_entry_footer')) : /** * Prints HTML with meta information for the categories, tags and comments. */ add_action('enwoo_single_cats_tags', 'enwoo_entry_footer'); function enwoo_entry_footer() { // Get Categories for posts. $categories_list = get_the_category_list(' '); // Get Tags for posts. $tags_list = get_the_tag_list('', ' '); // We don't want to output .entry-footer if it will be empty, so make sure its not. if ($categories_list || $tags_list ) { echo ''; } } endif; if (!function_exists('enwoo_generate_construct_footer_widgets')) : /** * Build footer widgets */ add_action('enwoo_generate_footer', 'enwoo_generate_construct_footer_widgets', 10); function enwoo_generate_construct_footer_widgets() { if (is_active_sidebar('enwoo-footer-area')) { ?>