/home/suroeste/public_html/wp-content/themes/ewebot
NameSizeModeActions
core/-0755rm
css/-0755rm
dist/-0777rm
elementor/-0755rm
fonts/-0755rm
img/-0755rm
js/-0755rm
templates/-0755rm
woocommerce/-0755rm
404.php13510644editdlrm
attachment.php15000644editdlrm
bloglisting.php45880644editdlrm
category.php15840644editdlrm
changelog.txt147810644editdlrm
comments.php41140644editdlrm
error_log2710644editdlrm
footer.php2540644editdlrm
full-width.php27080644editdlrm
functions.php796990644editdlrm
header.php12410644editdlrm
image.php43460644editdlrm
index.php20100644editdlrm
page.php28210644editdlrm
screenshot.png1009960644editdlrm
search.php43300644editdlrm
searchform.php5380644editdlrm
single-portfolio.php43240644editdlrm
single-team.php57220644editdlrm
single.php138480644editdlrm
style.css6170644editdlrm
tag.php500644editdlrm
Edit: /home/suroeste/public_html/wp-content/themes/ewebot/functions.php (79699B)
'puchase_code' ]; update_option( get_template(), $gt3_redux_options ); use \Elementor\Plugin as Elementor_Plugin; $theme = wp_get_theme(); $is_child = $theme->get('Template'); if(!empty($is_child)) { $theme = wp_get_theme($is_child); } define('GT3_THEME_VERSION', $theme->get('Version')); define('GT3_THEME_CUSTOMIZER', true); add_filter('gt3/core/dashboard', '__return_true'); add_filter('gt3/core/customizer/enabled', '__return_true'); require_once __DIR__.'/core/tgm.php'; if(!function_exists('gt3_option')) { function gt3_option($name, $subkey = null){ if(class_exists('\GT3\ThemesCore\Customizer') && GT3_THEME_CUSTOMIZER) { $customizer_theme_option = \GT3\ThemesCore\Customizer::instance()->get_option($name, $subkey); return isset($customizer_theme_option) ? $customizer_theme_option : null; } else { $value = null; $default_option = apply_filters('gt3/core/customizer/defaults', array()); if(key_exists($name, $default_option)) { $value = $default_option[$name]; } else { $default_option = apply_filters('gt3/core/customizer/elementor/defaults', array()); $globals = key_exists('__globals__', $default_option) ? (array) $default_option['__globals__'] : array(); foreach([ 'colors', 'typography' ] as $suffix) { $_key = $name.'_'.$suffix; $global = false; if(key_exists($name, $globals)) { $global = $globals[$name]; } else if(key_exists($_key, $globals)) { $global = $globals[$_key]; } if(false !== $global && preg_match('#globals/(\w+)\?id=([-_a-z]+)#i', $global, $matches)) { list($str, $key, $_subkey) = $matches; switch($key) { case 'colors': $value = gt3_customizer_get_repeater_setting($default_option['system_colors'], $_subkey); if (!is_null($value)) { $value = $value['color']; } break; case 'typography': $value = gt3_customizer_get_repeater_setting($default_option['system_typography'], $_subkey); if (!is_null($value)) { $value = gt3_collect_options('typography', $value); } break; } } if (key_exists($_key, $default_option)) { $value = $default_option[$_key]; } } } if (!is_null($subkey)) { $value = gt3_customizer_get_repeater_setting($default_option[$name], $subkey); if ($name === 'system_colors') { $value = (is_array($value) && key_exists('color', $value)) ? $value['color'] : null; } else if ($name === 'system_typography') { // $value = (is_array($value) ) ? gt3_collect_options('typography', $value) : null; } return $value; } if(null === $value && key_exists($name, $default_option)) { $value = isset($default_option[$name]) ? $default_option[$name] : null; } return $value; } } function gt3_customizer_get_repeater_setting($option, $subkey) { $value = array_search($subkey, array_column($option, '_id'));; return (false === $value) ? null : $option[$value]; } function gt3_collect_options($setting, $settings) { $value = array(); $length = strlen($setting)+1; foreach($settings as $setting_key => $setting_value) { if(0 === strpos($setting_key, $setting)) { $value[substr($setting_key, $length)] = $setting_value; } } return $value; } } if(!function_exists('gt3_customizer_enabled')) { function gt3_customizer_enabled(){ return false; } } require_once __DIR__.'/core/init.php'; add_filter( 'gt3/theme/redux/woocommerce_grid_list', function($options){ if(gt3_option('modern_shop') == '1' || true === gt3_option('modern_shop')) { $options = array_slice($options, 0, 1)+array( 'grid-extended' => esc_html__('Grid Extended', 'ewebot'), )+array_slice($options, 1); } return $options; } ); add_filter( 'wpda-builder/registration/settings', function($settings){ return array_merge( $settings, array( 'activated' => true, 'activatedByTheme' => true, ) ); } ); function gt3_content_width(){ $GLOBALS['content_width'] = apply_filters('gt3_content_width', 940); } add_action('after_setup_theme', 'gt3_content_width', 0); require_once __DIR__.'/core/emoji.php'; add_filter('body_class', 'gt3theme_class_names'); if(!function_exists('gt3theme_class_names')) { function gt3theme_class_names($class){ if(post_password_required()) { $class[] = 'body_pp'; } return $class; } } add_filter( 'gt3_testimonial_quote_src', function(){ return get_template_directory_uri().'/img/quote.png'; } ); add_action('wbc_importer_dir_path', 'gt3_get_demo_data_path'); function gt3_get_demo_data_path(){ return trailingslashit(str_replace('\\', '/', get_template_directory()))."/core/demo-data/"; } add_action('gt3_homepage_importer_filter', 'gt3_homepage_importer_filter'); function gt3_homepage_importer_filter(){ return array( 'demo' => 'Home 09', ); } add_action('gt3_homepage_importer_slider_name', 'gt3_homepage_importer_slider_name'); function gt3_homepage_importer_slider_name(){ return array( 'demo' => '', ); } add_filter('wp_get_attachment_image_attributes', 'gt3theme_attachment_image_attributes', 20, 3); function gt3theme_attachment_image_attributes($attr, $attachment, $size){ if(!key_exists('title', $attr)) { /* @var \WP_Post $attachment */ if($attachment instanceof \WP_Post) { $attr['title'] = $attachment->post_title; } } return $attr; } if(!function_exists('gt3_get_theme_option')) { function gt3_get_theme_option($optionname, $defaultValue = null){ $gt3_options = get_option("ewebot_gt3_options"); if(isset($gt3_options[$optionname])) { if(gettype($gt3_options[$optionname]) == "string") { return stripslashes($gt3_options[$optionname]); } else { return $gt3_options[$optionname]; } } else { return $defaultValue; } } } add_action( 'import_end', function(){ // if (!(isset($_REQUEST['type']) && isset($_REQUEST['content']) && $_REQUEST['type'] === 'import-demo-content' && $_REQUEST['content'] === 10)) return; if(class_exists('Elementor\Plugin')) { $doc = Elementor\Plugin::instance()->documents; $kit = Elementor\Plugin::instance()->kits_manager; $data = array( 'editor_post_id' => $kit->get_active_id(), 'post_status' => "publish", 'status' => "publish", 'elements' => array(), 'settings' => array( 'container_width' => array( 'size' => 1190, 'sizes' => [], 'unit' => "px", ), 'post_status' => 'publish' ) ); $doc->ajax_save($data); } } ); function gt3_set_options(){ update_option('elementor_disable_color_schemes', 'yes'); update_option('elementor_disable_typography_schemes', 'yes'); update_option('elementor_load_fa4_shim', 'yes'); if (class_exists('\Elementor\Plugin')) { $experiments = Elementor_Plugin::$instance->experiments; $features = $experiments->get_active_features(); foreach($features as $current_feature) { update_option($experiments->get_feature_option_key($current_feature['name']), $experiments::STATE_INACTIVE); } } // update_option('elementor_experiment-e_dom_optimization', 'inactive'); // update_option('elementor_experiment-e_optimized_assets_loading', 'inactive'); // update_option('elementor_experiment-e_optimized_css_loading', 'inactive'); // update_option('elementor_experiment-e_font_icon_svg', 'inactive'); // update_option('elementor_experiment-additional_custom_breakpoints', 'inactive'); update_option('elementor_css_print_method', 'external'); update_option('yith_woocompare_compare_button_in_products_list', 'yes'); // YITH Compare update_option('woocommerce_catalog_columns', '3'); update_option('woocommerce_catalog_rows', '3'); update_option('woocommerce_single_image_width', 1200); update_option('woocommerce_thumbnail_image_width', 800); update_option('gallery_thumbnail_image_width', 800); // AJAX Product Filters $gt3_br_filters = get_option('br_filters_options'); if(!is_array($gt3_br_filters)) { $gt3_br_filters = array(); } $gt3_br_filters['selected_area_show'] = '1'; $gt3_br_filters['selected_area_hide_empty'] = '1'; $gt3_br_filters['seo_friendly_urls'] = ''; update_option('br_filters_options', $gt3_br_filters); // Wishlist update_option('yith_wcwl_show_on_loop', 'yes'); } function gt3_activate_theme(){ if(current_user_can('manage_options') && !get_option('gt3_first_activation')) { update_option('gt3_first_activation', 'true'); gt3_set_options(); } } add_action('gt3/core/import/finish', 'gt3_set_options'); add_action('after_switch_theme', 'gt3_activate_theme'); if(!function_exists('gt3_wp_body_classes')) { function gt3_wp_body_classes($classes){ if(gt3_option("disable_right_click")) { $classes[] = 'disable_right_click'; wp_localize_script('gt3-theme', 'gt3_rcg', array( 'alert' => (gt3_option("disable_right_click_text")) )); } if(gt3_option('sticky_sidebar')) { $classes[] = 'gt3_enable_sticky_sidebar'; } /*if (gt3_option('modern_shop') == '1' || true === gt3_option('modern_shop')) { $classes[] = 'woocommerce'; $classes[] = 'woocommerce-page'; $classes[] = 'gt3_modern_shop'; }*/ return $classes; } } add_filter('body_class', 'gt3_wp_body_classes'); if(!function_exists('gt3_theme_comment')) { function gt3_theme_comment($comment, $args, $depth){ $max_depth_comment = ($args['max_depth'] > 4 ? 4 : $args['max_depth']); $GLOBALS['comment'] = $comment; ?>
  • id="li-comment-">
    ('.esc_html__('Edit', 'ewebot').')', ' ', '') ?>
    comment_approved == '0') : ?>

    '; if(class_exists('GT3_Core_Elementor')) { $icon_post_comments = ''.gt3_svg_icons_name('chat').''; } comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'reply_text' => (($icon_post_comments)).esc_html__('Reply', 'ewebot'), 'max_depth' => $max_depth_comment ) ) ) ?>
    max_num_pages; } if($max_page > 1) { $compile .= ''; } return $compile; } } if(!function_exists('gt3_HexToRGB')) { function gt3_HexToRGB($hex = "#ffffff"){ $color = array(); if(strlen($hex) < 1) { $hex = "#ffffff"; } $color['r'] = hexdec(substr($hex, 1, 2)); $color['g'] = hexdec(substr($hex, 3, 2)); $color['b'] = hexdec(substr($hex, 5, 2)); return $color['r'].",".$color['g'].",".$color['b']; } } if(!function_exists('gt3_smarty_modifier_truncate')) { function gt3_smarty_modifier_truncate($string, $length = 80, $etc = '... ', $break_words = false){ if($length == 0) { return ''; } if(mb_strlen($string, 'utf8') > $length) { $length -= mb_strlen($etc, 'utf8'); if(!$break_words) { $string = preg_replace('/\s+\S+\s*$/su', '', mb_substr($string, 0, $length+1, 'utf8')); } return mb_substr($string, 0, $length, 'utf8').$etc; } else { return $string; } } } if(!function_exists('gt3_get_pf_type_output')) { function gt3_get_pf_type_output($pf, $width, $height, $featured_image, $cols = false){ if(!$featured_image) { $featured_image = array( 0 => '', ); } $compile = ""; $ID = get_the_ID(); $alt_text = get_post_meta(get_post_thumbnail_id(get_the_ID()), '_wp_attachment_image_alt', true); if(empty($alt_text)) { $alt_text = get_the_title(get_the_ID()); } if(function_exists('gt3_get_image_srcset') && (bool) $cols) { switch($cols) { case '1': $responsive_dimensions = array( array( '1200', '1600' ), array( '992', '1200' ), array( '768', '992' ), array( '600', '768' ), array( '420', '600' ) ); break; case '2': $responsive_dimensions = array( array( '1200', '800' ), array( '992', '500' ), array( '768', '496' ), array( '600', '384' ), array( '420', '600' ) ); break; case '3': $responsive_dimensions = array( array( '1200', '540' ), array( '992', '400' ), array( '768', '496' ), array( '600', '384' ), array( '420', '600' ) ); break; case '4': $responsive_dimensions = array( array( '1200', '400' ), array( '992', '300' ), array( '768', '496' ), array( '600', '384' ), array( '420', '600' ) ); break; } $gt3_featured_image_url_srcset = gt3_get_image_srcset($featured_image[0], null, $responsive_dimensions); } else { $gt3_featured_image_url_srcset = 'src="'.esc_url(aq_resize($featured_image[0], $width, $height, true, true, true)).'"'; } $featured_standard = '
    '.(!(is_single() && get_post_type() == 'post') ? '' : '').''.esc_attr($alt_text).''.(!(is_single() && get_post_type() == 'post') ? '' : '').'
    '; if(class_exists('RWMB_Loader')) { $pf_post_content = $quote_author = $quote_text = $link = $link_text = $pf_post_meta = ''; switch($pf) { case 'gallery': $pf_post_content = rwmb_meta('post_format_gallery_images'); $pf_post_meta = get_post_meta(get_the_ID(), 'post_format_gallery_images'); break; case 'video': $pf_post_content = rwmb_meta('post_format_video_oEmbed', 'type=oembed'); $pf_post_meta = get_post_meta(get_the_ID(), 'post_format_video_oEmbed'); break; case 'audio': $pf_post_content = rwmb_meta('post_format_audio_oEmbed', 'type=oembed'); $pf_post_meta = get_post_meta(get_the_ID(), 'post_format_audio_oEmbed'); break; case 'quote': $quote_author = rwmb_meta('post_format_qoute_author'); $quote_author_image = rwmb_meta('post_format_qoute_author_image'); if(!empty($quote_author_image)) { $quote_author_image = array_values($quote_author_image); $quote_author_image = $quote_author_image[0]; $quote_author_image = $quote_author_image['url']; } else { $quote_author_image = ''; } $quote_text = rwmb_meta('post_format_qoute_text'); $pf_post_content = $quote_author.$quote_text; break; case 'link': $link = rwmb_meta('post_format_link'); $link_text = rwmb_meta('post_format_link_text'); $pf_post_content = $link.$link_text; break; } /* Gallery */ if($pf == 'gallery' && !empty($pf_post_meta)) { if(!empty($pf_post_content)) { if(count($pf_post_content) == 1) { $onlyOneImage = "oneImage"; } else { $onlyOneImage = ""; } $compile .= '
    '; foreach($pf_post_content as $image) { $img_url = $image["full_url"]; $compile .= "".esc_attr($alt_text).""; } $compile .= '
    '; wp_enqueue_script('jquery-slick'); } /* Video */ } else if($pf == 'video' && !empty($pf_post_meta)) { $video_autoplay_string = $video_class = $compile_image = ''; if(strlen($featured_image[0])) { $video_class .= ' has_post_thumb'; if(is_array($pf_post_meta) && !empty($pf_post_meta[0])) { $video_src = $pf_post_meta[0]; if(strpos($pf_post_meta[0], 'vimeo') !== false) { $video_class .= ' vimeo_video'; $video_autoplay_string = '?autoplay=1'; } else if(strpos($pf_post_meta[0], 'youtube') !== false) { $video_class .= ' youtube_video'; $video_autoplay_string = '&autoplay=1'; } } $compile_image .= '
    '; $compile_image .= '
    '.esc_attr($alt_text).'
    '; $compile_image .= '
    '; $compile_image .= ' '; $compile_image .= '
    '; $compile_image .= '
    '; } $compile .= '
    '.$compile_image; $compile .= strlen($featured_image[0]) ? '
    '.$pf_post_content.'
    ' : $pf_post_content; $compile .= '
    '; /* Audio */ } else if($pf == 'audio' && !empty($pf_post_meta)) { $compile .= '
    '.$pf_post_content.'
    '; /* Quote */ } else if($pf == 'quote' && strlen($pf_post_content) > 0) { $compile .= '
    '.(strlen($quote_author) && !empty($quote_author_image) ? '
    '.(!empty($quote_author_image) ? ''.esc_attr($alt_text).'' : '').'
    ' : '').(strlen($quote_text) ? '' : '').(strlen($quote_author) ? '
    '.esc_attr($quote_author).'
    ' : '').'
    '; /* Link */ } else if($pf == 'link' && strlen($pf_post_content) > 0) { $compile .= '
    '; $compile .= ''; if(strlen($link_text) > 0) { $compile .= esc_attr($link_text); } else { $compile .= esc_attr($link); } $compile .= ''; if(strlen($link) > 0) { $compile .= '

    '.esc_attr($link).'

    '; } $compile .= '
    '; /* Standard */ } else { $pf = 'standard'; if(strlen($featured_image[0]) > 0) { $compile .= $featured_standard; $pf = 'standard-image'; } } } else { $pf = 'standard'; if(strlen($featured_image[0]) > 0) { $compile .= $featured_standard; $pf = 'standard-image'; } } $compile = array( 'content' => $compile, 'pf' => $pf ); return $compile; } } if(!function_exists('gt3_get_field_media_and_attach_id')) { function gt3_get_field_media_and_attach_id($name, $attach_id, $previewW = "200px", $previewH = null, $classname = ""){ return "
    ".esc_attr($name)."
    "; } } function gt3_setup_theme(){ add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support('automatic-feed-links'); add_theme_support('revisions'); add_theme_support('post-formats', array( 'gallery', 'video', 'quote', 'audio', 'link' )); add_theme_support('custom-background'); add_theme_support('align-wide'); } add_action('after_setup_theme', 'gt3_setup_theme'); add_action('init', 'gt3_page_init'); if(!function_exists('gt3_page_init')) { function gt3_page_init(){ add_post_type_support('page', 'excerpt'); } } /// Post Page Settings // /*Work with options*/ if(!function_exists('gt3pb_get_option')) { function gt3pb_get_option($optionname, $defaultValue = ""){ $returnedValue = get_option("gt3pb_".$optionname, $defaultValue); if(gettype($returnedValue) == "string") { return stripslashes($returnedValue); } else { return $returnedValue; } } } if(!function_exists('gt3pb_delete_option')) { function gt3pb_delete_option($optionname){ return delete_option("gt3pb_".$optionname); } } if(!function_exists('gt3pb_update_option')) { function gt3pb_update_option($optionname, $optionvalue){ if(update_option("gt3pb_".$optionname, $optionvalue)) { return true; } } } add_action('wp_footer', 'gt3_wp_footer'); function gt3_wp_footer(){ echo gt3_get_theme_option("code_before_body"); } if(!function_exists('gt3_get_image_bg')) { function gt3_get_image_bg($gt3_img_src, $gt3_is_grid){ if(isset($gt3_is_grid) && $gt3_is_grid == 'yes') { echo "
    "; } else { echo "
    "; } } } if(!function_exists('gt3_get_color_bg')) { function gt3_get_color_bg($gt3_bg_color){ echo "
    "; } } if(!function_exists('gt3_page_title')) { function gt3_page_title(){ $title = ''; global $post; if(class_exists('WooCommerce') && is_product()) { $title = wp_kses_post(get_the_title()); } else if(class_exists('WooCommerce') && is_product_category()) { $title = single_cat_title('', false); } else if(class_exists('WooCommerce') && is_product_tag()) { $title = single_term_title("", false); } else if(class_exists('WooCommerce') && is_woocommerce()) { $title = woocommerce_page_title(false); } else if(is_category()) { $title = single_cat_title('', false); } else if(is_tag()) { $title = single_term_title("", false); } else if(is_archive() && get_queried_object() instanceof \WP_Term && in_array(get_queried_object()->taxonomy, array('portfolio_category', 'portfolio_tag'))) { $term = get_queried_object(); $title = $term->name; } else if(is_date()) { $title = get_the_time('F Y'); } else if(is_author()) { $title = esc_html__('Author:', 'ewebot')." ".esc_html(get_the_author()); } else if(is_search()) { $title = esc_html__(sprintf('Results for: %s', get_search_query()), 'ewebot'); } else if(is_404()) { $title = esc_html__('404', 'ewebot'); $post_404_page_id = intval(gt3_option('404_page_id')); if ($post && $post instanceof \WP_Post && $post->ID === $post_404_page_id) { $title = get_the_title(); } } else if(is_archive()) { $title = esc_html__('Archive', 'ewebot'); } else if(is_home() || is_front_page()) { $gt3_ID = gt3_get_queried_object_id(); $title = esc_html(get_the_title($gt3_ID)); } else { global $post; if(!empty($post)) { $id = $post->ID; if(is_sticky()) { $title = ''.esc_html(get_the_title($id)); } else { $title = esc_html(get_the_title($id)); } } else { $title = esc_html__('No Posts', 'ewebot'); } } return $title; } } function gt3_the_breadcrumb(){ $delimiter = ''; $home = esc_html__('Home', 'ewebot'); $showCurrent = 1; $before = ''; $after = ''; global $post; $homeLink = esc_url(home_url('/')); if(is_front_page() && !is_home()) { echo ''; } else if(class_exists('WooCommerce') && is_woocommerce()) { if(is_shop() && (gt3_option('modern_shop') == '1' || true === gt3_option('modern_shop'))) { return; } echo ''; } else { echo ''; } } if(!function_exists('gt3_preloader')) { function gt3_preloader(){ $id = gt3_get_queried_object_id(); $post_loader = (class_exists('RWMB_Loader') && $id !== 0); $mb_preloader = $post_loader ? rwmb_meta('mb_preloader', array(), $id) : false; if($mb_preloader == 'none') { return; } $preloader_mobile_disable = gt3_option('preloader_mobile_disable'); if($post_loader && $mb_preloader == 'custom') { $preloader_mobile_disable = rwmb_meta('mb_preloader_mobile_disable', array(), $id); } $is_mobile = false; if ($preloader_mobile_disable == '1' || true === $preloader_mobile_disable) { $is_mobile = wp_is_mobile(); } if((gt3_option('preloader') == '1' || gt3_option('preloader') === true || $mb_preloader == 'custom') && !$is_mobile) { $preloader_type = gt3_option('preloader_type'); $preloader_background = gt3_option('preloader_background'); $preloader_item_color = gt3_option('preloader_item_color'); $preloader_item_color2 = gt3_option('preloader_item_color2'); $preloader_logo = gt3_option('preloader_item_logo'); $preloader_logo_cont_w = gt3_option('preloader_item_logo_width'); $preloader_item_width = gt3_option('preloader_item_width'); $preloader_item_stroke = gt3_option('preloader_item_stroke'); $preloader_full = gt3_option('preloader_full'); $preloader_logo_url = $preloader_logo_width = ''; if(is_array($preloader_logo) && !empty($preloader_logo['url'])) { $preloader_logo_url = $preloader_logo['url']; } else if(!empty($preloader_logo)) { $preloader_logo_url = wp_get_attachment_image_url($preloader_logo, 'full'); } if(is_array($preloader_logo) && !empty($preloader_logo['width'])) { $preloader_logo_width = $preloader_logo['width']; } else if(!empty($preloader_logo)) { $image_attributes = wp_get_attachment_image_src($preloader_logo, 'full'); $preloader_logo_width = $image_attributes[2]; } if($post_loader && $mb_preloader == 'custom') { $preloader_type = rwmb_meta('mb_preloader_type', array(), $id); $preloader_background = rwmb_meta('mb_preloader_background', array(), $id); $preloader_item_color = rwmb_meta('mb_preloader_item_color', array(), $id); $preloader_item_color2 = rwmb_meta('mb_preloader_item_color2', array(), $id); $mb_preloader_item_logo = rwmb_meta('mb_preloader_item_logo', 'size=full', $id); if(!empty($mb_preloader_item_logo)) { $preloader_logo_src = array_values($mb_preloader_item_logo); $preloader_logo_url = $preloader_logo_src[0]['full_url']; $preloader_logo_width = $preloader_logo_src[0]['width']; } else { $preloader_logo_url = ''; } $preloader_logo_cont_w = rwmb_meta('mb_preloader_item_logo_width', array(), $id); $preloader_item_width = rwmb_meta('mb_preloader_item_width', array(), $id); $preloader_item_stroke = rwmb_meta('mb_preloader_item_stroke', array(), $id); $preloader_full = rwmb_meta('mb_preloader_full', array(), $id); } $preloader_background = !empty($preloader_background) ? $preloader_background : '#ffffff'; $preloader_item_color = !empty($preloader_item_color) ? $preloader_item_color : '#808080'; $preloader_item_color2 = !empty($preloader_item_color2) ? $preloader_item_color2 : '#e94e76'; $preloader_class = $preloader_full == '1' ? ' gt3_preloader_full' : ''; $preloader_class .= !empty($preloader_logo_url) ? ' gt3_preloader_image_on' : ''; if($preloader_type == 'linear') { $preldr_linear_style = 'background-color:'.$preloader_item_color.';color:'.$preloader_item_color2.';'; echo '
    '; echo '
    '; echo '
    '; if(!empty($preloader_logo_url)) { echo ''.esc_attr__('preloader', 'ewebot').''; } echo '
    '; echo '
    '; echo '
    '; echo '
    '; } else if($preloader_type == 'circle') { $preldr_width = is_array($preloader_item_width) && !empty($preloader_item_width['width']) ? (int) $preloader_item_width['width'] : $preloader_item_width; $preldr_str_width = is_array($preloader_item_stroke) && !empty($preloader_item_stroke['width']) ? (int) $preloader_item_stroke['width'] : $preloader_item_stroke; $preldr_circle_hp = $preldr_width/2; $preldr_circle_xy = $preldr_circle_hp*0.9; $preldr_circle_r = $preldr_circle_hp*0.8; $preldr_circle_l = 2*pi()*$preldr_circle_r; $preldr_circle_style = 'stroke:'.$preloader_item_color.'; stroke-dasharray: '.(float) $preldr_circle_l.'; stroke-width: '.(int) $preldr_str_width; $preldr_circle_style2 = 'stroke:'.$preloader_item_color2.'; stroke-dasharray: '.(float) $preldr_circle_l.'; stroke-width: '.(int) $preldr_str_width; $preldr_circle_logo_cont_style = 'width:'.$preloader_logo_cont_w.'px'.';'; echo '
    '; echo '
    '; echo '
    '; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
    '; echo '
    '; echo '
    '; } else { $preldr_width = is_array($preloader_item_width) && !empty($preloader_item_width['width']) ? (int) $preloader_item_width['width'] : $preloader_item_width; $preldr_str_width = is_array($preloader_item_stroke) && !empty($preloader_item_stroke['width']) ? (int) $preloader_item_stroke['width'] : $preloader_item_stroke; $preldr_circle_hp = $preldr_width/2; $preldr_circle_l = round(2*pi()*$preldr_circle_hp, 0); $preldr_dashoffset = round($preldr_circle_l/4, 0); $preldr_circle_style = 'stroke:'.$preloader_item_color2.'; stroke-dasharray: '.(float) $preldr_circle_l.'; stroke-width: '.(int) $preldr_str_width.'; stroke-dashoffset: '.$preldr_dashoffset.';'; $preldr_circle_logo_cont_style = 'width:'.$preloader_logo_cont_w.'px;'; echo '
    '; echo '
    '; echo '
    '; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
    '; echo '
    '; echo '
    '; } } } } if(!function_exists('gt3_get_page_title')) { function gt3_get_page_title($id){ $is_preview = gt3_customizer_enabled(); $page_title_conditional = ($is_preview || (gt3_option('page_title_conditional') == '1' || gt3_option('page_title_conditional') === true)) ? 'yes' : 'no'; $blog_title_conditional = ($is_preview || (gt3_option('blog_title_conditional') == '1' || gt3_option('blog_title_conditional') === true)) ? 'yes' : 'no'; $team_title_conditional = ($is_preview || (gt3_option('team_title_conditional') == '1' || gt3_option('team_title_conditional') === true)) ? 'yes' : 'no'; $portfolio_title_conditional = ($is_preview || (gt3_option('portfolio_title_conditional') == '1' || gt3_option('portfolio_title_conditional') === true)) ? 'yes' : 'no'; $product_title_conditional = ((gt3_option('product_title_conditional') == '1' || gt3_option('product_title_conditional') === true)) ? 'yes' : 'no'; $shop_cat_title_conditional = ((gt3_option('shop_cat_title_conditional') == '1' || gt3_option('shop_cat_title_conditional') === true)) ? 'yes' : 'no'; if(is_singular('post') && $page_title_conditional == 'yes' && $blog_title_conditional == 'no') { $page_title_conditional = 'no'; } if(is_singular('team') && $page_title_conditional == 'yes' && $team_title_conditional == 'no') { $page_title_conditional = 'no'; } if(is_singular('portfolio') && $page_title_conditional == 'yes' && $portfolio_title_conditional == 'no') { $page_title_conditional = 'no'; } if(is_singular('product') && $page_title_conditional == 'yes' && $product_title_conditional == 'no') { $page_title_conditional = 'no'; } else if(is_singular('product') && $page_title_conditional == 'yes' && $product_title_conditional == 'yes') { remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5); } if(class_exists('WooCommerce') && (is_product_category() || is_product_tag() || is_product_taxonomy()) && $page_title_conditional == 'yes' && $shop_cat_title_conditional == 'no') { $page_title_conditional = 'no'; } if($page_title_conditional == 'yes') { $customize_shop_title = gt3_option("customize_shop_title"); $page_title_breadcrumbs_conditional = (gt3_option("page_title_breadcrumbs_conditional") == '1' || true === gt3_option("page_title_breadcrumbs_conditional")) ? 'yes' : 'no'; if(class_exists('WooCommerce') && (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) && ($customize_shop_title == '1' || true === $customize_shop_title)) { $page_title_vert_align = gt3_option("shop_title_vert_align"); $page_title_horiz_align = gt3_option("shop_title_horiz_align"); $page_title_font_color = gt3_option("shop_title_font_color"); $page_title_bg_color = gt3_option("shop_title_bg_color"); $page_title_bg_image_array = gt3_option("shop_title_bg_image"); $page_title_height = gt3_option("shop_title_height"); $page_title_bottom_margin = gt3_option("shop_title_bottom_margin"); $page_title_top_border = gt3_option("shop_title_top_border"); $page_title_top_border_color = gt3_option("shop_title_top_border_color"); $page_title_bottom_border = gt3_option("shop_title_bottom_border"); $page_title_bottom_border_color = gt3_option("shop_title_bottom_border_color"); } else { $page_title_vert_align = gt3_option("page_title_vert_align"); $page_title_horiz_align = gt3_option("page_title_horiz_align"); $page_title_font_color = gt3_option("page_title_font_color"); $page_title_bg_color = gt3_option("page_title_bg_color"); $page_title_bg_image_array = gt3_option("page_title_bg_image"); $page_title_height = gt3_option("page_title_height"); $page_title_bottom_margin = gt3_option("page_title_bottom_margin"); $page_title_top_border = gt3_option("page_title_top_border"); $page_title_top_border_color = gt3_option("page_title_top_border_color"); $page_title_bottom_border = gt3_option("page_title_bottom_border"); $page_title_bottom_border_color = gt3_option("page_title_bottom_border_color"); } $page_title_height = is_array($page_title_height) && !empty($page_title_height['height']) ? (int) $page_title_height['height'] : (int) $page_title_height; $page_title_bottom_margin = is_array($page_title_bottom_margin) && !empty($page_title_bottom_margin['margin-bottom']) ? (int) $page_title_bottom_margin['margin-bottom'] : (int) $page_title_bottom_margin; } if(class_exists('RWMB_Loader') && $id !== 0) { $page_sub_title = rwmb_meta('mb_page_sub_title', array(), $id); $mb_page_sub_title_color = rwmb_meta('mb_page_sub_title_color', array(), $id); $mb_page_title_conditional = rwmb_meta('mb_page_title_conditional', array(), $id); $mb_page_title_use_feature_image = rwmb_meta('mb_page_title_use_feature_image', array(), $id); if($mb_page_title_conditional == 'yes') { $page_title_conditional = 'yes'; $page_title_breadcrumbs_conditional = rwmb_meta('mb_show_breadcrumbs', array(), $id) == '1' ? 'yes' : 'no'; $page_title_vert_align = rwmb_meta('mb_page_title_vertical_align', array(), $id); $page_title_horiz_align = rwmb_meta('mb_page_title_horizontal_align', array(), $id); $page_title_font_color = rwmb_meta('mb_page_title_font_color', array(), $id); $page_title_bg_color = rwmb_meta('mb_page_title_bg_color', array(), $id); $page_title_height = rwmb_meta('mb_page_title_height', array(), $id); $page_title_top_border = rwmb_meta("mb_page_title_top_border", array(), $id); $mb_page_title_top_border_color = rwmb_meta("mb_page_title_top_border_color", array(), $id); $mb_page_title_top_border_color_opacity = rwmb_meta("mb_page_title_top_border_color_opacity", array(), $id); if(!empty($mb_page_title_top_border_color) && $page_title_top_border == '1') { $page_title_top_border_color['rgba'] = 'rgba('.(gt3_HexToRGB($mb_page_title_top_border_color)).','.$mb_page_title_top_border_color_opacity.')'; } else { $page_title_top_border_color = ''; } $page_title_bottom_border = rwmb_meta("mb_page_title_bottom_border", array(), $id); $mb_page_title_bottom_border_color = rwmb_meta("mb_page_title_bottom_border_color", array(), $id); $mb_page_title_bottom_border_color_opacity = rwmb_meta("mb_page_title_bottom_border_color_opacity", array(), $id); if(!empty($mb_page_title_bottom_border_color) && $page_title_bottom_border == '1') { $page_title_bottom_border_color['rgba'] = 'rgba('.(gt3_HexToRGB($mb_page_title_bottom_border_color)).','.$mb_page_title_bottom_border_color_opacity.')'; } else { $page_title_bottom_border_color = ''; } $page_title_bottom_margin = rwmb_meta("mb_page_title_bottom_margin", array(), $id); } else if($mb_page_title_conditional == 'no') { $page_title_conditional = 'no'; } } $gt3_page_title = is_home() && is_front_page() ? esc_html__('Blog', 'ewebot') : gt3_page_title(); if($page_title_conditional == 'yes' && !empty($gt3_page_title)) { $page_title_classes = !empty($page_title_horiz_align) ? ' gt3-page-title_horiz_align_'.esc_attr($page_title_horiz_align) : ' gt3-page-title_horiz_align_left'; $page_title_classes .= !empty($page_title_vert_align) ? ' gt3-page-title_vert_align_'.esc_attr($page_title_vert_align) : ' gt3-page-title_vert_align_middle'; $page_title_classes .= !empty($page_title_height) && (int) $page_title_height < 80 ? ' gt3-page-title_small_header' : ''; $page_title_styles = !empty($page_title_bg_color) ? 'background-color:'.esc_attr($page_title_bg_color).';' : ''; $page_title_styles .= !empty($page_title_height) ? 'height:'.esc_attr($page_title_height).'px;' : ''; $page_title_styles .= !empty($page_title_font_color) ? 'color:'.esc_attr($page_title_font_color).';' : ''; $page_title_styles .= !empty($page_title_bottom_margin) ? 'margin-bottom:'.esc_attr($page_title_bottom_margin).'px;' : ''; if($page_title_top_border == '1') { $page_title_styles .= is_array($page_title_top_border_color) && !empty($page_title_top_border_color['rgba']) ? 'border-top: 1px solid '.esc_attr($page_title_top_border_color['rgba']).';' : 'border-top: 1px solid '.esc_attr($page_title_top_border_color).';'; } if($page_title_bottom_border == '1') { $page_title_styles .= is_array($page_title_bottom_border_color) && !empty($page_title_bottom_border_color['rgba']) ? 'border-bottom: 1px solid '.esc_attr($page_title_bottom_border_color['rgba']).';' : 'border-bottom: 1px solid '.esc_attr($page_title_bottom_border_color).';'; } $customize_shop_title = gt3_option("customize_shop_title"); if(class_exists('WooCommerce') && (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) && ($customize_shop_title == '1' || true === $customize_shop_title)) { $title_background = gt3_background_render('shop_title', 'mb_page_title_conditional', 'yes', true); } else { $title_background = gt3_background_render('page_title', 'mb_page_title_conditional', 'yes', true); } $bg_src = !empty($image_array['background-image']) ? $image_array['background-image'] : ''; if(!empty($title_background) && is_array($title_background) && gt3_get_queried_object_id() !== 0 && !empty($mb_page_title_use_feature_image) && (bool) $mb_page_title_use_feature_image) { if(!empty($mb_page_title_conditional) && $mb_page_title_conditional == 'yes') { if(class_exists('WooCommerce') && (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) && ($customize_shop_title == '1' || true === $customize_shop_title)) { $title_background = gt3_background_render('shop_title', 'mb_page_title_use_feature_image', '1', true, true); } else { $title_background = gt3_background_render('page_title', 'mb_page_title_use_feature_image', '1', true, true); } } $bg_src = get_the_post_thumbnail_url(gt3_get_queried_object_id(), 'full'); $title_background['background-image'] = 'background-image:url('.esc_url($bg_src).');'; } $title_background = implode('', $title_background); $page_title_classes .= !empty($title_background) ? ' gt3-page-title_has_img_bg' : ''; $page_title_styles .= $title_background; $page_title_classes .= ($page_title_bg_color == '#fff' || $page_title_bg_color == '#ffffff') && empty($title_background) ? ' gt3-page-title_default_color_a' : ''; $customize_shop_title = gt3_option("customize_shop_title"); if(class_exists('WooCommerce') && (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) && ($customize_shop_title == '1' || true === $customize_shop_title)) { $image_array = gt3_option("page_title_bg_image"); } else { $image_array = gt3_option("shop_title_bg_image"); } if(class_exists('RWMB_Loader') && gt3_get_queried_object_id() !== 0) { if('mb_page_title_conditional' != false) { $mb_conditional = rwmb_meta('mb_page_title_conditional', array(), $id); if($mb_conditional == 'yes') { $bg_src = rwmb_meta('mb_page_title_bg_image', array(), $id); $bg_src = !empty($bg_src) ? $bg_src : ''; if(!empty($bg_src)) { $bg_src = array_values($bg_src); $bg_src = $bg_src[0]['url']; } } } } $page_title_fill = $page_fill_inner_class = ''; /* if (!empty($bg_src)) { $page_title_fill_color = getSolidColorFromImage(esc_url($bg_src)); $page_title_fill = "
    "; $page_fill_inner_class = 'has_fill_inner'; } */ echo '
    '; echo "
    "; echo (($page_title_fill))."
    "; echo "
    "; echo "
    "; if(is_single() && get_post_type() == 'portfolio') { $item_category = ''; $categories = get_the_terms(get_the_ID(), 'portfolio_category'); if(!$categories || is_wp_error($categories)) { $categories = array(); } if(count($categories)) { $item_category = array(); foreach($categories as $category) { $item_category[] = ''.$category->name.''; } $item_category = implode(' ', $item_category); } if (true === gt3_option("page_title_meta_conditional")) { echo "
    ".$item_category."
    "; } } $page_title_names_conditional = (gt3_option("page_title_names_conditional") == '1' || true === gt3_option("page_title_names_conditional")) ? 'yes' : 'no'; if($page_title_names_conditional == 'yes') { echo "

    ".wp_kses_post($gt3_page_title)."

    "; } if(!empty($page_sub_title)) { echo "
    "; echo esc_attr($page_sub_title); echo "
    "; } if($page_title_breadcrumbs_conditional == 'yes') { echo "
    "; gt3_the_breadcrumb(); echo "
    "; } if(is_single() && get_post_type() == 'post') { if(get_comments_number(get_the_ID()) == 1) { $comments_text = ' '.esc_html__('comment', 'ewebot'); } else { $comments_text = ' '.esc_html__('comments', 'ewebot'); } $post = get_post(get_the_ID()); if (true === gt3_option("page_title_meta_conditional")) { echo "
    "; the_category(', '); echo ""; if((int) get_comments_number(get_the_ID()) != 0) { echo "".esc_html(get_comments_number(get_the_ID())).$comments_text.""; } echo "
    "; } } echo "
    "; echo "
    "; echo "
    "; echo "
    "; echo '
    '; } } } if(!function_exists('gt3_main_menu')) { function gt3_main_menu(){ wp_nav_menu( array( 'theme_location' => 'main_menu', 'container' => '', 'container_class' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'walker' => new GT3_Walker_Nav_Menu (), ) ); } } // need for vertical view of header in theme options (admin) if(!function_exists('gt3_add_admin_class_menu_order')) { add_filter('admin_body_class', 'gt3_add_admin_class_menu_order'); function gt3_add_admin_class_menu_order($classes){ if(gt3_option('bottom_header_vertical_order')) { $classes .= ' bottom_header_vertical_order'; } return $classes; } } // need for comparing (theme_options or metabox) and out html with background settings if(!function_exists('gt3_background_render')) { function gt3_background_render($opt_name, $meta_conditional = false, $meta_value = false, $return_array = false, $force_bg_style = false){ $image_array = gt3_option($opt_name."_bg_image"); $bg_src = !empty($image_array['background-image']) ? $image_array['background-image'] : ''; $bg_repeat = !empty($image_array['background-repeat']) ? $image_array['background-repeat'] : ''; $bg_size = !empty($image_array['background-size']) ? $image_array['background-size'] : ''; $attachment = !empty($image_array['background-attachment']) ? $image_array['background-attachment'] : ''; $position = !empty($image_array['background-position']) ? $image_array['background-position'] : ''; if(class_exists('\GT3\ThemesCore\Customizer')) { $bg_image_id = gt3_option($opt_name."_bg_image_image"); $bg_image_repeat = gt3_option($opt_name."_bg_image_repeat"); $bg_image_size = gt3_option($opt_name."_bg_image_size"); $bg_image_attachment = gt3_option($opt_name."_bg_image_attachment"); $bg_image_position = gt3_option($opt_name."_bg_image_position"); $bg_src = !empty($bg_image_id) ? wp_get_attachment_image_url($bg_image_id, 'full') : ''; $bg_repeat = !empty($bg_image_repeat) ? $bg_image_repeat : ''; $bg_size = !empty($bg_image_size) ? $bg_image_size : ''; $attachment = !empty($bg_image_attachment) ? $bg_image_attachment : ''; $position = !empty($bg_image_position) ? $bg_image_position : ''; } $id = gt3_get_queried_object_id(); if(class_exists('RWMB_Loader') && $id !== 0) { if($meta_conditional != false) { $mb_conditional = rwmb_meta($meta_conditional, array(), $id); if($mb_conditional == $meta_value) { if ($opt_name === 'shop_title') { $opt_name = 'page_title'; } $bg_src = rwmb_meta('mb_'.$opt_name.'_bg_image', array(), $id); $bg_src = !empty($bg_src) ? $bg_src : ''; if(!empty($bg_src)) { $bg_src = array_values($bg_src); $bg_src = $bg_src[0]['url']; } if(!empty($bg_src) || $force_bg_style) { $bg_repeat = rwmb_meta('mb_'.$opt_name.'_bg_repeat', array(), $id); $bg_repeat = !empty($bg_repeat) ? $bg_repeat : ''; $bg_size = rwmb_meta('mb_'.$opt_name.'_bg_size', array(), $id); $bg_size = !empty($bg_size) ? $bg_size : ''; $attachment = rwmb_meta('mb_'.$opt_name.'_bg_attachment', array(), $id); $attachment = !empty($attachment) ? $attachment : ''; $position = rwmb_meta('mb_'.$opt_name.'_bg_position', array(), $id); $position = !empty($position) ? $position : ''; } else { $bg_repeat = ''; $bg_size = ''; $attachment = ''; $position = ''; } } } } $bg_styles = array(); $bg_styles['background-image'] = !empty($bg_src) ? 'background-image:url('.esc_url($bg_src).');' : ''; if(!empty($bg_src) || $force_bg_style) { $bg_styles['background-size'] = !empty($bg_size) ? 'background-size:'.esc_attr($bg_size).';' : ''; $bg_styles['background-repeat'] = !empty($bg_repeat) ? 'background-repeat:'.esc_attr($bg_repeat).';' : ''; $bg_styles['background-attachment'] = !empty($attachment) ? 'background-attachment:'.esc_attr($attachment).';' : ''; $bg_styles['background-position'] = !empty($position) ? 'background-position:'.esc_attr($position).';' : ''; } if($return_array) { return $bg_styles; } return implode('', $bg_styles); } } // return all sidebars if(!function_exists('gt3_get_all_sidebar')) { function gt3_get_all_sidebar(){ global $wp_registered_sidebars; $out = array( '' => '' ); if(empty($wp_registered_sidebars)) { return; } foreach($wp_registered_sidebars as $sidebar_id => $sidebar) : $out[$sidebar_id] = $sidebar['name']; endforeach; return $out; } } //* Tiny mce adding *// function gt3_mce_buttons(){ if(current_user_can('edit_posts') && current_user_can('edit_pages')) { add_filter('mce_external_plugins', 'gt3_add_external_plugins', '11'); add_filter('mce_buttons_3', 'gt3_mce_buttons_register_button', '11'); add_filter('mce_buttons_2', 'gt3_mce_buttons_2', '11'); } } add_action('init', 'gt3_mce_buttons'); function gt3_add_external_plugins($plugin_array){ $plugin_array['gt3_external_tinymce_plugins'] = get_template_directory_uri().'/core/admin/js/tinymce-button.js'; return $plugin_array; } function gt3_mce_buttons_register_button($buttons){ array_push($buttons, 'SocialIcon', 'DropCaps', 'Highlighter', 'TitleLine', 'LinkStyling', 'ListStyle', 'Columns', 'ToolTip'); return $buttons; } function gt3_mce_buttons_2($buttons){ array_unshift($buttons, 'styleselect'); return $buttons; } function gt3_tiny_mce_before_init($settings){ $settings['theme_advanced_blockformats'] = 'p,h1,h2,h3,h4'; $style_formats = array( array( 'title' => esc_html__('Font Weight', 'ewebot'), 'items' => array( array( 'title' => esc_html__('Default', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => 'inherit' ) ), array( 'title' => esc_html__('Lightest (100)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '100' ) ), array( 'title' => esc_html__('Lighter (200)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '200' ) ), array( 'title' => esc_html__('Light (300)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '300' ) ), array( 'title' => esc_html__('Normal (400)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '400' ) ), array( 'title' => esc_html__('Medium (500)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '500' ) ), array( 'title' => esc_html__('Semi-Bold (600)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '600' ) ), array( 'title' => esc_html__('Bold (700)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '700' ) ), array( 'title' => esc_html__('Bolder (800)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '800' ) ), array( 'title' => esc_html__('Extra Bold (900)', 'ewebot'), 'inline' => 'span', 'classes' => 'gt3_font-weight', 'styles' => array( 'font-weight' => '900' ) ) ), ), ); $settings['style_formats'] = str_replace('"', "'", json_encode($style_formats)); $settings['extended_valid_elements'] = 'span[*],a[*],i[*]'; return $settings; } add_filter('tiny_mce_before_init', 'gt3_tiny_mce_before_init'); function gt3_theme_add_editor_styles(){ add_editor_style('css/font-awesome.min.css'); add_editor_style('css/tiny_mce.css'); } add_action('current_screen', 'gt3_theme_add_editor_styles'); function gt3_wpdocs_theme_add_editor_styles(){ add_editor_style('css/font-awesome.min.css'); add_editor_style('css/tiny_mce.css'); } add_action('current_screen', 'gt3_wpdocs_theme_add_editor_styles'); // end function gt3_categories_postcount_filter($variable){ preg_match('/(class="count")/', $variable, $matches); if(empty($matches)) { $variable = str_replace(' (', ' ', $variable); $variable = str_replace(' (', ' ', $variable); $variable = str_replace(')', '', $variable); } return $variable; } add_filter('get_archives_link', 'gt3_categories_postcount_filter'); add_filter('wp_list_categories', 'gt3_categories_postcount_filter'); if(!function_exists('gt3_open_graph_meta')) { add_action('wp_head', 'gt3_open_graph_meta', 5); function gt3_open_graph_meta(){ global $post; if(!is_singular()) //if it is not a post or a page { return; } echo ''; echo ''; echo ''; echo ''; if(has_post_thumbnail($post->ID)) { //the post does not have featured image, use a default image $thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium_large'); echo ''; } } } if(!function_exists('gt3_translateColumnWidthToSpan')) { function gt3_translateColumnWidthToSpan($gt3_width){ preg_match('/(\d+)\/(\d+)/', $gt3_width, $matches); if(!empty($matches)) { $part_x = (int) $matches[1]; $part_y = (int) $matches[2]; if($part_x > 0 && $part_y > 0) { $value = ceil($part_x/$part_y*12); $value2 = ceil((1-$part_x/$part_y)*12); if($value > 0 && $value <= 12) { $gt3_width = array(); $gt3_width[] = $value; $gt3_width[] = $value2; } } } return $gt3_width; } } function gt3_get_queried_object_id(){ $id = get_queried_object_id(); if($id == 0 && class_exists('WooCommerce')) { if(is_shop()) { $id = get_option('woocommerce_shop_page_id'); } else if(is_cart()) { $id = get_option('woocommerce_cart_page_id'); } else if(is_checkout()) { $id = get_option('woocommerce_checkout_page_id'); } } return $id; } if(!function_exists('getSolidColorFromImage')) { function getSolidColorFromImage($filepath){ $attach_id = gt3_get_image_id($filepath); if(!empty($attach_id)) { $solid_color = get_post_meta($attach_id, 'solid_color', true); if(!empty($solid_color)) { return $solid_color; } } $type = wp_check_filetype($filepath); if(!empty($type) && is_array($type) && !empty($type['ext'])) { $type = $type['ext']; } else { return '#D3D3D3'; } $allowedTypes = array( 'gif', // [] gif 'jpg', // [] jpg 'png', // [] png 'bmp' // [] bmp ); if(!in_array($type, $allowedTypes)) { return '#D3D3D3'; } $im = false; switch($type) { case 'gif' : $im = imageCreateFromGif($filepath); break; case 'jpg' : $im = imageCreateFromJpeg($filepath); break; case 'png' : $im = imageCreateFromPng($filepath); break; case 'bmp' : $im = imageCreateFromBmp($filepath); break; } if($im) { $thumb = imagecreatetruecolor(1, 1); imagecopyresampled($thumb, $im, 0, 0, 0, 0, 1, 1, imagesx($im), imagesy($im)); $mainColor = strtoupper(dechex(imagecolorat($thumb, 0, 0))); update_post_meta($attach_id, 'solid_color', $mainColor); return $mainColor; } else { return '#D3D3D3'; } } } function gt3_get_image_id($image_url){ global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url)); return $attachment[0]; } add_filter( 'gt3/elementor/core/cpt/register', function(){ return array( 'team', 'portfolio', ); } ); function gt3_filter_allowed_html($allowed, $context){ if(!empty($allowed['a']) && is_array($allowed['a'])) { $allowed['a']['data-color'] = true; $allowed['a']['data-hover-color'] = true; } return $allowed; } add_filter('wp_kses_allowed_html', 'gt3_filter_allowed_html', 10, 2); function gt3_pingback_header(){ if(is_singular() && pings_open()) { echo ''; } } add_action('wp_head', 'gt3_pingback_header'); /* WPDA Burger */ add_filter( 'wpda-builder/elementor/widgets', function($widgets){ $widgets[] = 'Burger_Sidebar'; return $widgets; } ); add_filter( 'wpda_burger_sidebar_icon', function(){ return ''; } ); /* WPDA Walker */ add_filter( 'wpda_walker_menu', function(){ return new GT3_Walker_Nav_Menu (); } ); /* BUBBLES */ if(!function_exists('gt3_get_bubbles')) { function gt3_get_bubbles(){ $bubbles_block = gt3_option('bubbles_block'); if(class_exists('RWMB_Loader')) { $mb_bubbles_block = rwmb_meta('mb_bubbles_block', array(), gt3_get_queried_object_id()); if(!empty($mb_bubbles_block) && $mb_bubbles_block != 'default') { $bubbles_block = $mb_bubbles_block; } } if(gt3_customizer_enabled()) { $bubbles_block = true; } if($bubbles_block == '1' || $bubbles_block == 'show' || true === $bubbles_block) { echo "
    "; } } } /* GT3 Default Header */ if(!function_exists('gt3_get_default_header')) { function gt3_get_default_header(){ $header = apply_filters('theme/print_header', false); if(false === $header) { echo "
    "; // Logo echo ""; //Menu if(has_nav_menu('main_menu')) { echo "
    "; echo "
    "; echo '
    '; echo "
    "; } echo "
    "; // Mobile Menu ob_start(); if(has_nav_menu('main_menu')) { gt3_main_menu(); } $menu = ob_get_clean(); if(!empty($menu)) { echo "
    "; } echo "
    "; } } } if(!function_exists('gt3_get_default_footer')) { function gt3_get_default_footer(){ echo '
    '; } } add_filter('gt3/core/mega-menu-enable', '__return_true'); function gt3_theme_style($handle, $url = '', $deps = array(), $version = GT3_THEME_VERSION){ if(class_exists('\GT3\ThemesCore\Assets\Style')) { \GT3\ThemesCore\Assets\Style::enqueue_theme_asset($handle); return; } wp_enqueue_style('gt3-'.$handle, $url, $deps, $version); } function gt3_theme_script($handle, $url = '', $deps = array(), $version = GT3_THEME_VERSION){ if(class_exists('\GT3\ThemesCore\Assets\Script')) { \GT3\ThemesCore\Assets\Script::enqueue_theme_asset($handle); return; } wp_enqueue_script('gt3-'.$handle, $url, $deps, $version, true); } /** * Remove/Disable/DeQueue jQuery Migrate in WordPress. */ add_action( 'wp_head', function(){ wp_register_style('gt3-main_inline-handle', false); wp_enqueue_style('gt3-main_inline-handle'); $css = <<
  • "; } if(class_exists('Woocommerce') && is_product()) { do_action('gt3_footer_action'); } if((gt3_option('modern_shop') == '1' || true === gt3_option('modern_shop')) && function_exists('gt3_has_shop_on_page') && gt3_has_shop_on_page()) { echo '
    '; } }, 10 ); add_filter('gt3/core/docs/url', function() { return 'https://help.ewebotwp.com/docs/'; }); $has_shop_on_page = false; add_filter( 'elementor/frontend/builder_content_data', function($data, $post_id) use (&$has_shop_on_page){ if (!$has_shop_on_page) { $has_shop_on_page = find_shop_on_page($post_id); } return $data; },10,2 ); function gt3_has_shop_on_page() { global $has_shop_on_page; static $is_shop = null; if(!is_null($is_shop)) { return $is_shop; } if ($has_shop_on_page) { $is_shop = $has_shop_on_page; return $is_shop; } if(!class_exists('WooCommerce')) { $is_shop = false; return $is_shop; } if(is_singular()) { global $post; $is_shop = find_shop_on_page($post->ID); } if(!$is_shop && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy() || is_product() || is_cart() || is_account_page() || is_checkout()) || (function_exists('yith_wcwl_is_wishlist_page') && yith_wcwl_is_wishlist_page())) { $is_shop = true; } if(!$is_shop) { $is_shop = false; } return $is_shop; } function find_shop_on_page($post_id, $data = array()) { $is_shop = false; $meta = get_post_meta($post_id, '_elementor_controls_usage', true); $meta = maybe_unserialize($meta); if(is_array($meta) && (key_exists('gt3-core-shoplist', $meta) || key_exists('wpda-builder-cart', $meta))) { $is_shop = true; } if (!$is_shop) { if (class_exists('\Elementor\Plugin')) { $elementor = \Elementor\Plugin::instance(); $elementor_post = $elementor->documents->get($post_id); $is_meta_updated = null; if($elementor_post !== false) { $meta = $elementor_post->get_json_meta('_elementor_data'); foreach($meta as &$level0) { $is_shop = gt3_find_elementor_widget($level0); if($is_shop) { break; } } } } } return $is_shop; } function gt3_find_elementor_widget(&$key){ if(key_exists('widgetType', $key) && in_array($key['widgetType'], array( 'gt3-core-shoplist', 'wpda-builder-cart'))) { return true; } if(key_exists('elements', $key) && is_array($key['elements']) && count($key['elements'])) { foreach($key['elements'] as &$element) { if (gt3_find_elementor_widget($element)) return true; } } return false; }