%k25u25%fgd5n!
<?php if ( ! defined( 'ABSPATH' ) ) { die( 'Direct access forbidden.' ); }
/**
* Theme Configuration and Custom CSS initializtion
*/
/**
* Global theme config for header/footer/sections/colors/fonts
*/
if ( !function_exists('windazo_theme_config') ) {
add_filter( 'ltx_get_theme_config', 'windazo_theme_config', 10, 1 );
function windazo_theme_config() {
return array(
'navbar' => array(
'white' => esc_html__( 'Default. White Background', 'windazo' ),
'white-border' => esc_html__( 'Default. White Background with border', 'windazo' ),
'hamburger-transparent' => esc_html__( 'Desktop Hamburger Transparent', 'windazo' ),
),
'navbar-default' => 'white',
'footer' => array(
'default' => esc_html__( 'Default', 'windazo' ),
'copyright' => esc_html__( 'Copyright Only', 'windazo' ),
'copyright-transparent' => esc_html__( 'Copyright Transparent', 'windazo' ),
),
'footer-default' => 'default',
'color_main' => '#E6BF55',
'color_second' => '#769B54',
'color_black' => '#262022',
'color_gray' => '#F6F3EE',
'color_white' => '#FFFFFF',
'color_red' => '#AA3F44',
'color_main_header' => esc_html__( 'Peach', 'windazo' ),
'font_main' => 'Merriweather',
'font_main_var' => 'regular',
'font_main_weights' => '400,400i,700',
'font_headers' => 'Magra',
'font_headers_var' => 'regular',
'font_headers_weights' => '700',
'font_subheaders' => 'Magra',
'font_subheaders_var' => 'regular',
'font_subheaders_weights' => '700',
);
}
}
/**
* Editor Settings
*/
function windazo_editor_settings() {
$cfg = windazo_theme_config();
add_theme_support( 'editor-color-palette', array(
array(
'name' => esc_html__( 'Main', 'windazo' ),
'slug' => 'main-theme',
'color' => $cfg['color_main'],
),
array(
'name' => esc_html__( 'Gray', 'windazo' ),
'slug' => 'gray',
'color' => $cfg['color_gray'],
),
array(
'name' => esc_html__( 'Black', 'windazo' ),
'slug' => 'black',
'color' => $cfg['color_black'],
),
array(
'name' => esc_html__( 'Red', 'windazo' ),
'slug' => 'red',
'color' => $cfg['color_red'],
),
) );
add_theme_support( 'editor-font-sizes', array(
array(
'name' => esc_html__( 'small', 'windazo' ),
'shortName' => esc_html__( 'S', 'windazo' ),
'size' => 14,
'slug' => 'small'
),
array(
'name' => esc_html__( 'regular', 'windazo' ),
'shortName' => esc_html__( 'M', 'windazo' ),
'size' => 16,
'slug' => 'regular'
),
array(
'name' => esc_html__( 'large', 'windazo' ),
'shortName' => esc_html__( 'L', 'windazo' ),
'size' => 24,
'slug' => 'large'
),
) );
}
add_action( 'after_setup_theme', 'windazo_editor_settings', 10 );
/**
* Get Google default font url
*/
if ( !function_exists('windazo_font_url') ) {
function windazo_font_url() {
$cfg = windazo_theme_config();
$q = array();
foreach ( array('font_main', 'font_headers', 'font_subheaders') as $item ) {
if ( !empty($cfg[$item]) ) {
$w = '';
if ( !empty($cfg[$item.'_weights']) ) {
$w .= ':'.$cfg[$item.'_weights'];
}
$q[] = $cfg[$item].$w;
}
}
$query_args = array( 'family' => implode('|', $q), 'subset' => 'latin' );
$font_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
return esc_url( $font_url );
}
}
/**
* Config used for lt-ext plugin to set Visual Composer configuration
*/
if ( !function_exists('windazo_vc_config') ) {
add_filter( 'ltx_get_vc_config', 'windazo_vc_config', 10, 1 );
function windazo_vc_config( $value ) {
return array(
'sections' => array(
esc_html__("Overflow visible section", 'windazo') => "displaced-top",
esc_html__("Gray short block", 'windazo') => "ltx-gray-short",
esc_html__("Black form", 'windazo') => "ltx-form-black",
),
'background' => array(
esc_html__( "Main", 'windazo' ) => "theme_color",
esc_html__( "Second", 'windazo' ) => "second",
esc_html__( "Gray", 'windazo' ) => "gray",
esc_html__( "White", 'windazo' ) => "white",
esc_html__( "Black", 'windazo' ) => "black",
),
'overlay' => array(
esc_html__( "Semi-Black Overlay (50%)", 'windazo' ) => "half",
esc_html__( "Black Overlay (60%)", 'windazo' ) => "black",
esc_html__( "Black Overlay with shadow (60%)", 'windazo' ) => "dark",
esc_html__( "Overlay with shadow only", 'windazo' ) => "true-black",
esc_html__( "Extra Black", 'windazo' ) => "xblack",
esc_html__( "White Overlay", 'windazo' ) => "white",
esc_html__( "With Highlight", 'windazo' ) => "highlight",
),
);
}
}
/*
* Adding additional TinyMCE options
*/
if ( !function_exists('windazo_mce_before_init_insert_formats') ) {
add_filter('mce_buttons_2', 'windazo_wpb_mce_buttons_2');
function windazo_wpb_mce_buttons_2( $buttons ) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter( 'tiny_mce_before_init', 'windazo_mce_before_init_insert_formats' );
function windazo_mce_before_init_insert_formats( $init_array ) {
$style_formats = array(
array(
'title' => esc_html__('Main Color', 'windazo'),
'block' => 'span',
'classes' => 'color-main',
'wrapper' => true,
),
array(
'title' => esc_html__('White Color', 'windazo'),
'block' => 'span',
'classes' => 'color-white',
'wrapper' => true,
),
array(
'title' => esc_html__('Large Text', 'windazo'),
'block' => 'span',
'classes' => 'text-lg',
'wrapper' => true,
),
array(
'title' => 'List Checkbox',
'selector' => 'ul',
'classes' => 'check',
),
array(
'title' => 'Read More Link',
'selector' => 'a',
'classes' => 'more-link',
),
);
$init_array['style_formats'] = json_encode( $style_formats );
return $init_array;
}
}
/**
* Register widget areas.
*
*/
if ( !function_exists('windazo_action_theme_widgets_init') ) {
add_action( 'widgets_init', 'windazo_action_theme_widgets_init' );
function windazo_action_theme_widgets_init() {
$span_class = 'widget-icon';
$header_class = $theme_icon = '';
if ( function_exists('FW') ) {
$theme_icon = fw_get_db_settings_option( 'theme-icon-main' );
if ( !empty($theme_icon['icon-class']) ) {
$span_class .= ' '.$theme_icon['icon-class'];
$header_class = 'hasIcon';
}
}
register_sidebar( array(
'name' => esc_html__( 'Sidebar Default', 'windazo' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Displayed in the right/left section of the site.', 'windazo' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="header-widget '.esc_attr($header_class).'"><span class="'.esc_attr($span_class).'"></span>',
'after_title' => '<span class="last '.esc_attr($span_class).'"></span></h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar WooCommerce', 'windazo' ),
'id' => 'sidebar-wc',
'description' => esc_html__( 'Displayed in the right/left section of the site.', 'windazo' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="header-widget '.esc_attr($header_class).'"><span class="'.esc_attr($span_class).'"></span>',
'after_title' => '<span class="last '.esc_attr($span_class).'"></span></h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'windazo' ),
'id' => 'footer-1',
'description' => esc_html__( 'Displayed in the footer section of the site.', 'windazo' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="header-widget '.esc_attr($header_class).'"><span class="'.esc_attr($span_class).'"></span>',
'after_title' => '<span class="last '.esc_attr($span_class).'"></span></h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'windazo' ),
'id' => 'footer-2',
'description' => esc_html__( 'Displayed in the footer section of the site.', 'windazo' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="header-widget '.esc_attr($header_class).'"><span class="'.esc_attr($span_class).'"></span>',
'after_title' => '<span class="last '.esc_attr($span_class).'"></span></h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'windazo' ),
'id' => 'footer-3',
'description' => esc_html__( 'Displayed in the footer section of the site.', 'windazo' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="header-widget '.esc_attr($header_class).'"><span class="'.esc_attr($span_class).'"></span>',
'after_title' => '<span class="last '.esc_attr($span_class).'"></span></h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 4', 'windazo' ),
'id' => 'footer-4',
'description' => esc_html__( 'Displayed in the footer section of the site.', 'windazo' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="header-widget '.esc_attr($header_class).'"><span class="'.esc_attr($span_class).'"></span>',
'after_title' => '<span class="last '.esc_attr($span_class).'"></span></h3>',
) );
}
}
/**
* Additional styles init
*/
if ( !function_exists('windazo_css_style') ) {
add_action( 'wp_enqueue_scripts', 'windazo_css_style', 10 );
function windazo_css_style() {
global $wp_query;
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap-grid.css', array(), '1.0' );
wp_enqueue_style( 'windazo-plugins', get_template_directory_uri() . '/assets/css/plugins.css', array(), wp_get_theme()->get('Version') );
wp_enqueue_style( 'windazo-theme-style', get_stylesheet_uri(), array( 'bootstrap', 'windazo-plugins' ), wp_get_theme()->get('Version') );
}
}
/**
* Wp-admin styles and scripts
*/
if ( !function_exists('windazo_admin_init') ) {
add_action( 'after_setup_theme', 'windazo_admin_init' );
function windazo_admin_init() {
add_action("admin_enqueue_scripts", 'windazo_admin_scripts');
}
function windazo_admin_scripts() {
if ( function_exists('fw_get_db_settings_option') ) {
$fontello['css'] = fw_get_db_settings_option( 'fontello-css' );
$fontello['eot'] = fw_get_db_settings_option( 'fontello-eot' );
$fontello['ttf'] = fw_get_db_settings_option( 'fontello-ttf' );
$fontello['woff'] = fw_get_db_settings_option( 'fontello-woff' );
$fontello['woff2'] = fw_get_db_settings_option( 'fontello-woff2' );
$fontello['svg'] = fw_get_db_settings_option( 'fontello-svg' );
if ( !empty($fontello['css']) AND !empty( $fontello['eot']) AND !empty( $fontello['ttf']) AND !empty( $fontello['woff']) AND !empty( $fontello['woff2']) AND !empty( $fontello['svg']) ) {
wp_enqueue_style( 'windazo-fontello', $fontello['css']['url'], array(), wp_get_theme()->get('Version') );
$randomver = wp_get_theme()->get('Version');
$css_content = "@font-face {
font-family: 'windazo-fontello';
src: url('". esc_url ( $fontello['eot']['url']. "?" . $randomver )."');
src: url('". esc_url ( $fontello['eot']['url']. "?" . $randomver )."#iefix') format('embedded-opentype'),
url('". esc_url ( $fontello['woff2']['url']. "?" . $randomver )."') format('woff2'),
url('". esc_url ( $fontello['woff']['url']. "?" . $randomver )."') format('woff'),
url('". esc_url ( $fontello['ttf']['url']. "?" . $randomver )."') format('truetype'),
url('". esc_url ( $fontello['svg']['url']. "?" . $randomver )."#" . pathinfo(wp_basename( $fontello['svg']['url'] ), PATHINFO_FILENAME) . "') format('svg');
font-weight: normal;
font-style: normal;
}";
wp_add_inline_style( 'windazo-fontello', $css_content );
}
wp_enqueue_script( 'windazo-theme-admin', get_template_directory_uri() . '/assets/js/scripts-admin.js', array( 'jquery' ) );
}
}
}