/**
* ThemeCube Framework functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package ThemeCube Framework
*/
if ( ! function_exists( 'themecube_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function themecube_setup() {
// Redux Framework
require get_template_directory() . '/inc/init/admin-init.php';
// Global
$themecube = get_option('themecube');
// Navwalker
require_once get_template_directory() . '/inc/nav-walker.php';
//Metabox Functions
require_once get_template_directory() . '/inc/metabox-functions.php';
// Textdomain
load_theme_textdomain( 'escape', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
// Document title
add_theme_support( 'title-tag' );
// Enable support for Post Thumbnails on posts and pages
add_theme_support( 'post-thumbnails' );
// Register Menus
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'escape' ),
'footer' => esc_html__( 'Footer', 'escape' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Set up the WordPress core custom background feature. *SİL*
add_theme_support( 'custom-background', apply_filters( 'themecube_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/** *SİL*
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
) );
}
endif;
add_action( 'after_setup_theme', 'themecube_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function themecube_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'themecube_content_width', 640 );
}
add_action( 'after_setup_theme', 'themecube_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function themecube_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'escape' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'escape' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'WooCommerce Sidebar', 'escape' ),
'id' => 'shop',
'description' => esc_html__( 'Add widgets here.', 'escape' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer widget Area 1', 'escape' ),
'id' => 'footer-widget-area-1',
'description' => esc_html__( 'Add widgets here.', 'escape' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer widget Area 2', 'escape' ),
'id' => 'footer-widget-area-2',
'description' => esc_html__( 'Add widgets here.', 'escape' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer widget Area 3', 'escape' ),
'id' => 'footer-widget-area-3',
'description' => esc_html__( 'Add widgets here.', 'escape' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer widget Area 4', 'escape' ),
'id' => 'footer-widget-area-4',
'description' => esc_html__( 'Add widgets here.', 'escape' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer widget Area 5', 'escape' ),
'id' => 'footer-widget-area-5',
'description' => esc_html__( 'Add widgets here.', 'escape' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'themecube_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function themecube_scripts() {
/* Scripts */
wp_enqueue_script("bootstrap", get_template_directory_uri()."/js/bootstrap.min.js",array('jquery'),false,true);
wp_enqueue_script("retina", get_template_directory_uri()."/js/retina.min.js",array(),false,true);
wp_enqueue_script("leaflet", get_template_directory_uri()."/js/leaflet.js",array(),false,false);
wp_enqueue_script("counterup", get_template_directory_uri()."/js/jquery.counterup.min.js",array(),false,true);
wp_enqueue_script("owl-carousel", get_template_directory_uri()."/js/owl.carousel.min.js",array(),false,true);
wp_enqueue_script("waypoints", get_template_directory_uri()."/js/waypoints.min.js",array(),false,true);
wp_enqueue_script("instafeed", get_template_directory_uri()."/js/instafeed.min.js",array(),false,true);
wp_enqueue_script("magnific-popup", get_template_directory_uri()."/js/jquery.magnific-popup.min.js",array(),false,true);
wp_enqueue_script("input-tweak", get_template_directory_uri()."/js/input-spinner.js",array(),false,true);
wp_enqueue_script("nice-select", get_template_directory_uri()."/js/jquery.nice-select.min.js",array('jquery'),false,true);
wp_enqueue_script("themecube-scripts", get_template_directory_uri()."/js/scripts.js",array(),false,true);
/* Styles */
wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/bootstrap.min.css');
wp_style_add_data( 'bootstrap', 'rtl', 'replace' );
wp_enqueue_style( 'feather-icons', get_template_directory_uri().'/css/iconfont.css');
wp_enqueue_style( 'fontawesome', get_template_directory_uri().'/css/fontawesome.min.css');
wp_enqueue_style( 'brand-icons', get_template_directory_uri().'/css/brands.min.css');
wp_enqueue_style( 'leaflet', get_template_directory_uri().'/css/leaflet.css');
wp_enqueue_style( 'pe-7-icon', get_template_directory_uri().'/css/pe-icon-7-stroke.css');
wp_enqueue_style( 'helper', get_template_directory_uri().'/css/helper.css');
wp_enqueue_style( 'owl-carousel', get_template_directory_uri().'/css/owl.carousel.css');
wp_enqueue_style( 'owl-theme', get_template_directory_uri().'/css/owl.theme.css');
wp_enqueue_style( 'owl-transition', get_template_directory_uri().'/css/owl.transitions.css');
wp_enqueue_style( 'magnific-popup', get_template_directory_uri().'/css/magnific-popup.css');
wp_enqueue_style( 'nice-select', get_template_directory_uri().'/css/nice-select.css');
wp_enqueue_style( 'themecube-style', get_stylesheet_uri() );
wp_style_add_data( 'themecube-style', 'rtl', 'replace' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'themecube_scripts' );
//DYNAMIC STYLES
if ( !function_exists( 'themecube_dynamic_style' ) ) {
function themecube_dynamic_style() {
if ( is_admin_bar_showing() ) {
wp_register_style( 'themecube_nav_display', false );
wp_enqueue_style( 'themecube_nav_display' );
wp_add_inline_style( 'themecube_nav_display',
'.fixed-top { top: 46px !important; }
@media (min-width: 768px) { .fixed-top { top: 32px !important; } }'
);
}
if (!function_exists('themecube_hex2rgb')){
function themecube_hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = array($r, $g, $b);
return $rgb; // returns an array with the rgb values
}
}
if(class_exists('ReduxFramework')) {
$themecube = get_option('themecube');
$primary_rgba = themecube_hex2rgb($themecube['primary_color']);
wp_register_style( 'themecube_rgba_option', false );
wp_enqueue_style( 'themecube_rgba_option' );
wp_add_inline_style( 'themecube_rgba_option',
'.widget button[type="submit"]:focus,
.btn-outline-primary.focus,
.btn-outline-primary:focus,
.btn-primary.focus,
.btn-primary:focus {
box-shadow: 0 0 0 0.2rem rgba('.esc_attr($primary_rgba[0]).','.esc_attr($primary_rgba[1]).','. esc_attr($primary_rgba[2]).',.5) !important;
}'
);
}
if ( is_front_page() ) {
wp_register_style( 'themecube_nav_transparent', false );
wp_enqueue_style( 'themecube_nav_transparent' );
wp_add_inline_style( 'themecube_nav_transparent',
'.navbar-custom.default { background-color: transparent !imporant; }
#page { margin-top: 0 !important; }'
);
}
}
}
add_action( 'wp_enqueue_scripts', 'themecube_dynamic_style' );
//CUSTOM CSS
if (!function_exists('themecube_custom_css')) {
function themecube_custom_css(){
$themecube = get_option('themecube');
if (!empty($themecube['css_editor'])){
echo '';
} else
echo "";
}
}
add_action('wp_enqueue_style','themecube_custom_css');
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
/**
* Load WooCommerce compatibility file.
*/
if ( class_exists( 'WooCommerce' ) ) {
require get_template_directory() . '/inc/woocommerce.php';
}
function themecube_do_shortcode($content) {
global $shortcode_tags;
if (empty($shortcode_tags) || !is_array($shortcode_tags))
return $content;
$pattern = get_shortcode_regex();
return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
}
/* Visual Composer */
if(function_exists('vc_add_param')){
vc_add_param('vc_row',array(
"type" => "dropdown",
"heading" => esc_html__('Fullwidth', 'escape'),
"param_name" => "fullwidth",
"value" => array(
esc_html__('No', 'escape') => 'no',
esc_html__('Yes', 'escape') => 'yes',
),
"description" => esc_html__("Select Fullwidth or not", 'escape'),
)
);
vc_add_param('vc_row_inner',array(
"type" => "dropdown",
"heading" => esc_html__('Fullwidth', 'escape'),
"param_name" => "fullwidth",
"value" => array(
esc_html__('No', 'escape') => 'no',
esc_html__('Yes', 'escape') => 'yes',
),
"description" => esc_html__("Select Fullwidth or not", 'escape'),
)
);
}
//Backend CSS
if ( !function_exists( 'themecube_backend_css' ) ) {
function themecube_backend_css() {
wp_enqueue_style( 'admin-css', get_template_directory_uri().'/css/admin.css', false, '', 'all' );
wp_style_add_data( 'admin-css', 'rtl', 'replace' );
wp_enqueue_style( 'feather-icons', get_template_directory_uri().'/css/iconfont.css');
wp_enqueue_style( 'fontawesome-min', get_template_directory_uri().'/css/fontawesome.min.css');
wp_enqueue_style( 'brand-icons', get_template_directory_uri().'/css/brands.min.css');
wp_enqueue_style( 'pe-7-icon', get_template_directory_uri().'/css/pe-icon-7-stroke.css');
wp_enqueue_style( 'helper', get_template_directory_uri().'/css/helper.css');
}
add_action( 'admin_enqueue_scripts', 'themecube_backend_css' );
}
//Rooms Excerpt
function themecube_get_the_room_excerpt(){
$excerpt = get_the_content();
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$the_str = substr($excerpt, 0, 150);
return $the_str;
}
//Fix Anchor links
function themecube_fix_anchor_links( $atts, $item, $args ) {
if ( $item->xfn == 'scroll' ) {
$atts['href'] = ''. esc_url(home_url('/')).''.$item->url .'';
}
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'themecube_fix_anchor_links', 10, 3 );
//Demo Import
if ( !function_exists( 'themecube_demo_import' ) ) {
function themecube_demo_import( $demo_active_import , $demo_directory_path ) {
reset( $demo_active_import );
$current_key = key( $demo_active_import );
//Rev Slider
if ( class_exists( 'RevSlider' ) ) {
$wbc_sliders_array = array(
'Light' => 'fullscreen-video.zip', //Set slider zip name
);
if ( isset( $demo_active_import[$current_key]['directory'] ) && !empty( $demo_active_import[$current_key]['directory'] ) && array_key_exists( $demo_active_import[$current_key]['directory'], $wbc_sliders_array ) ) {
$wbc_slider_import = $wbc_sliders_array[$demo_active_import[$current_key]['directory']];
if ( file_exists( $demo_directory_path.$wbc_slider_import ) ) {
$slider = new RevSlider();
$slider->importSliderFromPost( true, true, $demo_directory_path.$wbc_slider_import );
}
}
}
$wbc_menu_array = array('Light');
if ( isset( $demo_active_import[$current_key]['directory'] ) && !empty( $demo_active_import[$current_key]['directory'] ) && in_array( $demo_active_import[$current_key]['directory'], $wbc_menu_array ) ) {
$top_menu = get_term_by( 'name', 'primary', 'nav_menu' );
$footer_menu = get_term_by( 'name', 'footer', 'nav_menu' );
set_theme_mod( 'nav_menu_locations', array(
'primary' => $top_menu->term_id,
'footer' => $footer_menu->term_id,
)
);
}
$wbc_home_pages = array(
'Light' => 'HomePage',
);
if ( isset( $demo_active_import[$current_key]['directory'] ) && !empty( $demo_active_import[$current_key]['directory'] ) && array_key_exists( $demo_active_import[$current_key]['directory'], $wbc_home_pages ) ) {
$page = get_page_by_title( $wbc_home_pages[$demo_active_import[$current_key]['directory']] );
if ( isset( $page->ID ) ) {
update_option( 'page_on_front', $page->ID );
update_option( 'show_on_front', 'page' );
}
}
}
add_action( 'wbc_importer_after_content_import', 'themecube_demo_import', 10, 2 );
}
Warning: Cannot modify header information - headers already sent by (output started at /home/kochowi/domains/hellbus.pl/public_html/wp-content/themes/escape/functions.php:1) in /home/kochowi/domains/hellbus.pl/public_html/wp-includes/pluggable.php on line 1531
Warning: Cannot modify header information - headers already sent by (output started at /home/kochowi/domains/hellbus.pl/public_html/wp-content/themes/escape/functions.php:1) in /home/kochowi/domains/hellbus.pl/public_html/wp-includes/pluggable.php on line 1534