tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ /*-----------------------------------------------------------------------------------*/ global $avova_fn_option, $post; function frenify_theme_header_markup(){ global $avova_fn_option; if(isset($avova_fn_option['header_switcher']) && $avova_fn_option['header_switcher'] === 'disabled'){ return ''; } ob_start(); get_template_part( 'inc/templates/template-header' ); $out1 = ob_get_contents(); ob_end_clean(); return $out1; } function frenify_theme_footer_markup(){ global $avova_fn_option; if(isset($avova_fn_option['footer_switch']) && $avova_fn_option['footer_switch'] === 'disable'){ return ''; } ob_start(); get_template_part( 'inc/templates/template-footer' ); $out1 = ob_get_contents(); ob_end_clean(); return $out1; } function avova_fn_buy_button(){ global $woocommerce; if ( class_exists( 'WooCommerce' ) ) { // buy $svgText = esc_html__('svg','avova'); $buyIcon = get_template_directory_uri().'/assets/svg/shopping-cart.svg'; $buySVG = ''.esc_attr($svgText).''; $cartBox = avova_fn_getCartBox(); $buyHTML = '
'.$buySVG.''.esc_html($woocommerce->cart->cart_contents_count).''.$cartBox.'
'; }else{ $buyHTML = ''; } return $buyHTML; } function avova_fn_getCartBox($in = '',$pageFrom = ''){ global $woocommerce; $items = $woocommerce->cart->get_cart(); $html = '
'; if($in == 'yes'){ $html = ''; } if(!empty($items)){ $subTotalText = esc_html__('Subtotal:', 'avova'); $deleteItemText = esc_html__('Remove this product from the cart', 'avova'); $cartURL = ''.esc_html__('View Cart', 'avova').''; $checkoutURL = ''.esc_html__('Checkout', 'avova').''; $html .= '
'; $list = '
'; $icon = avova_fn_getSVG_theme('cancel'); foreach($items as $item => $values) { $productID = $values['product_id']; $_product = wc_get_product( $values['data']->get_id() ); $getProductDetail = wc_get_product( $productID ); $image = $getProductDetail->get_image(); $quantity = $values['quantity']; $title = $_product->get_title(); $productURL = es_url(get_permalink($productID)); $price = wc_price(get_post_meta($productID , '_price', true)); $priceHolder = ''.$quantity . " x " . $price.''; $titleHolder = ''.$title.''; $deleteItem = ''.$icon.''; if((is_cart() || is_checkout()) || $pageFrom != ''){ $deleteItem = ''; } $list .= '
'; $list .= ''; $list .= '
'.$titleHolder.$priceHolder.$deleteItem.'
'; $list .= '
'; } $list .= '
'; // footer $subTotalPrice = $woocommerce->cart->get_cart_subtotal(); $footer = ''; $html .= $list; $html .= $footer; $html .= '
'; if($in == 'yes'){ }else{ $html .= '
'; } }else{ $returnToShop = ''.esc_html__('Return to shop','avova').''; $emptyText = esc_html__('Your cart is currently empty', 'avova'); $html .= '

'.$emptyText.$returnToShop.'

'; if($in == 'yes'){ }else{ $html .= ''; } } return $html; } function avova_fn_remove_item_from_cart(){ global $avova_fn_option,$woocommerce; $isAjaxCall = true; if(isset($_POST['pageFrom'])){ $pageFrom = sanitize_text_field($_POST['pageFrom']); } $cart = WC()->instance()->cart; $id = sanitize_text_field($_POST['product_id']); if($id != ''){ $cart_id = $cart->generate_cart_id($id); $cart_item_id = $cart->find_product_in_cart($cart_id); if($cart_item_id){ $cart->set_quantity($cart_item_id,0); } } // get cartbox $cartBox = avova_fn_getCartBox('yes',$pageFrom); $newCount = $woocommerce->cart->cart_contents_count; $subTotalPrice = $woocommerce->cart->get_cart_subtotal(); // remove whitespaces form the ajax HTML $search = array( '/\>[^\S ]+/s', // strip whitespaces after tags, except space '/[^\S ]+\', '<', '\\1' ); $cartBox = preg_replace($search, $replace, $cartBox); $updateContent = '

'.esc_html__('The cart has been changed somewhere. Please, update the cart.','avova').''.esc_html__('Update the cart','avova').'

'; $buffyArray = array( 'avova_fn_data' => $cartBox, 'count' => $newCount, 'subtotal' => $subTotalPrice, 'update' => $updateContent, ); if ( true === $isAjaxCall ) { die(json_encode($buffyArray)); } else { return json_encode($buffyArray); } } function avova_fn_search_form( $form ) { $form = ''; return $form; } add_filter( 'get_search_form', 'avova_fn_search_form', 100 ); function avova_fn_custom_password_form() { global $post; $loginurl = home_url() . '/wp-login.php?action=postpass'; ob_start(); ?>
$taxonomy) { // exclude post tags if( in_array( $taxonomy, $exclude ) ) { continue; } $selectedPostTaxonomies[$key] = $taxonomy; } } } else { } // custom post cats return $selectedPostTaxonomies; } function html5_search_form( $form ) { $form = ''; return $form; } add_filter( 'get_search_form', 'html5_search_form' ); function avova_fn_get_category($postID, $count = 1, $postType = 'post'){ $taxonomy = avova_fn_post_taxanomy($postType)[0]; return ''.avova_fn_taxanomy_list($postID, $taxonomy, false, $count).''; } function avova_fn_hex2rgba($color, $opacity = false) { $default = 'rgb(0,0,0)'; //Return default if no color provided if(empty($color)){ return $default; } //Sanitize $color if "#" is provided if ($color[0] == '#' ) { $color = substr( $color, 1 ); } //Check if color has 6 or 3 characters and get values if (strlen($color) == 6) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } //Convert hexadec to rgb $rgb = array_map('hexdec', $hex); //Check if opacity is set(rgba or rgb) if($opacity){ if(abs($opacity) > 1){ $opacity = 1.0; } $output = 'rgba('.implode(",",$rgb).','.$opacity.')'; } else { $output = 'rgb('.implode(",",$rgb).')'; } //Return rgb(a) color string return $output; } function avova_fn_get_author_meta($postID){ $dateMeta = '
'.get_the_time(get_option('date_format'), $postID).'
'; $authorImage = ''; $authorName = get_the_author_meta('display_name'); $authorURL = get_author_posts_url(get_the_author_meta('ID')); $authorHolder = ''.esc_html($authorName).''; return '
'.$authorImage.'

'.$authorHolder.'

'.$dateMeta.'
'; } function avova_fn_get_category_info($postID, $postType = 'post', $categoryCount = 2, $time = 'yes'){ $categoryCount = (int)$categoryCount; $taxonomy = avova_fn_post_taxanomy($postType)[0]; $catHolder = ''; if(avova_fn_taxanomy_list($postID, $taxonomy, false, $categoryCount) != ""){ $catHolder = avova_fn_taxanomy_list($postID, $taxonomy, false, $categoryCount, '', 'fn_category'); } $readTime = ''; if($time == 'yes'){ $readTime = ''.avova_fn_getSVG_theme('read').''.avova_fn_reading_time(get_the_content()).''; } return '
'.$catHolder.$readTime.'
'; } function avova_fn_get_categories($postID, $postType = 'post', $categoryCount = 999){ $categoryCount = (int)$categoryCount; $taxonomy = avova_fn_post_taxanomy($postType)[0]; $catHolder = ''; if(avova_fn_taxanomy_list($postID, $taxonomy, false, $categoryCount) != ""){ $catHolder = avova_fn_taxanomy_list($postID, $taxonomy, false, $categoryCount, ',', 'fn_category'); } return '
'.$catHolder.'
'; } function avova_fn_get_author_meta_by_post_id($postID){ $dateMeta = '
'.get_the_time(get_option('date_format'), $postID).'
'; $authorImage = ''; $authorName = get_the_author_meta('display_name'); $authorURL = get_author_posts_url(get_the_author_meta('ID')); $authorHolder = ''.esc_html($authorName).''; return '
'.$authorImage.'

'.$authorHolder.'

'.$dateMeta.'
'; } function avova_fn_post_term_list($postid, $taxanomy, $echo = true, $max = 2, $seporator = ' , '){ $terms = $termlist = $term_link = $cat_count = ''; $terms = get_the_terms($postid, $taxanomy); if($terms != ''){ $cat_count = sizeof($terms); if($cat_count >= $max){$cat_count = $max;} for($i = 0; $i < $cat_count; $i++){ $term_link = get_term_link( $terms[$i]->slug, $taxanomy ); $termlist .= ''.$terms[$i]->name.''.$seporator; } $termlist = trim($termlist, $seporator); } if($echo == true){ echo wp_kses($termlist, 'post'); }else{ return $termlist; } } add_filter('wp_list_categories', 'avova_fn_cat_count_span'); function avova_fn_cat_count_span($links) { $links = str_replace(' (', ' ', $links); $links = str_replace(')', '', $links); return $links; } function avova_fn_if_has_sidebar(){ if(is_single()){ if ( is_active_sidebar( 'main-sidebar' ) ){ return true; }else{ return false; } }else { if ( is_active_sidebar( 'main-sidebar' ) ){ return true; }else{ return false; } } } function avova_fn_ajax_portfolio(){ global $avova_fn_option; $filter_page = ''; $fn_list = ''; $post_number = 9; if(isset($avova_fn_option['portfolio_perpage'])){ $post_number = $avova_fn_option['portfolio_perpage']; } if(!empty($_POST['filter_page'])){ $filter_page = $_POST['filter_page']; } if(!empty($_POST['filter_page'])){ $filter_page = $_POST['filter_page']; } $image_size = 'avova_fn_thumb-720-9999'; if(isset($avova_fn_option['project_page_image_size'])){ $image_size = $avova_fn_option['project_page_image_size']; } $paged = (int)$filter_page; $query_args = array( 'post_type' => 'avova-project', 'paged' => $paged, 'post_status' => 'publish', ); $query_args2 = array( 'post_type' => 'avova-project', 'post_status' => 'publish', ); // List Style $list_style = 'grid'; if(isset($avova_fn_option['project_page_list_style'])){ $list_style = $avova_fn_option['project_page_list_style']; } // Ratio $ratio = 1; if(isset($avova_fn_option['project_page_grid_ratio'])){ $ratio = (float)$avova_fn_option['project_page_grid_ratio']; } if($list_style == 'grid'){ $ratio = $ratio - 1; $size = 'margin-bottom:calc('.$ratio.' * 100%);'; $thumb = ''.esc_attr__('Image', 'avova').''; } $query_args['posts_per_page'] = -1; $loop2 = new \WP_Query($query_args); $all_posts_count = count($loop2->posts); $query_args['posts_per_page'] = $post_number; $avova_fn_loop = new \WP_Query($query_args); $specified_posts_count = count($avova_fn_loop->posts); $post_taxonomy = avova_fn_post_taxanomy('avova-project')[0]; foreach ( $avova_fn_loop->posts as $key => $fnPost ) { setup_postdata( $fnPost ); $postID = $fnPost->ID; $postPermalink = esc_url(get_permalink($postID)); $postImage = get_the_post_thumbnail_url( $postID, $image_size ); $postTitle = $fnPost->post_title; $cats__mobile = avova_fn_post_term_list($postID, $post_taxonomy, false, 9999, ', '); $cats__liClass = avova_fn_post_term_list_second($postID, $post_taxonomy, false, ' ', true); $overlay = '
'; $img_holder = '
'.esc_attr__('Image', 'avova').''.$overlay.'
'; if($list_style == 'grid'){ $img_holder = '
'.$thumb.$overlay.'
'; } $title_holder = '

'.$cats__mobile.'

'.$postTitle.'

'; $fn_list .= '
  • '.$img_holder.$title_holder.'
  • '; wp_reset_postdata(); } $disabled = ''; if(($specified_posts_count + ($post_number*($paged-1))) >= $all_posts_count){ $disabled = 'disabled'; } $buffyArray = array( 'data' => $fn_list, 'disabled' => $disabled, ); die(json_encode($buffyArray)); } function avova_fn_getCategoriesByQuery($posts,$post_type,$text){ $post_taxonomy = avova_fn_post_taxanomy($post_type)[0]; $array = array(); foreach($posts->posts as $fn_post){ setup_postdata( $fn_post ); $post_id = $fn_post->ID; $arr = avova_fn_post_term_list_third($post_id, $post_taxonomy); $array = array_merge($arr,$array); wp_reset_postdata(); } if(!empty($array)){ $output = '
    '; return $output; } return ''; } function avova_fn_post_term_list_third($postid, $taxanomy){ $array = array(); $terms = get_the_terms($postid, $taxanomy); if($terms != ''){ $cat_count = sizeof($terms); for($i = 0; $i < $cat_count; $i++){ $categoryName = $terms[$i]->name; $categoryName = strtolower($categoryName); $categoryName = str_replace(" ","_", $categoryName); $array['key_'.$categoryName] = $terms[$i]->name; } } return $array; } function avova_fn_post_term_list_second($postid, $taxanomy, $url = false, $separator = ' ', $space = false){ $terms = $termlist = $term_link = $cat_count = ''; $terms = get_the_terms($postid, $taxanomy); if($terms != ''){ $cat_count = sizeof($terms); for($i = 0; $i < $cat_count; $i++){ $termLink = get_term_link( $terms[$i]->slug, $taxanomy ); $termName = $terms[$i]->name; if($space == true){ $termName = strtolower($termName); $termName = str_replace(' ', '_', $termName); } if($url == true){ $termlist .= ''.$termName.''.$separator; }else{ $termlist .= $termName.$separator; } } $termlist = trim($termlist, $separator); } return wp_kses_post($termlist); } function avova_fn_reading_time( $content ) { // Predefined words-per-minute rate. $words_per_minute = 120; $words_per_second = $words_per_minute / 60; // Count the words in the content. $word_count = str_word_count( strip_tags( $content ) ); // [UNUSED] How many minutes? $minutes = floor( $word_count / $words_per_minute ); // [UNUSED] How many seconds (remainder)? $seconds_remainder = floor( $word_count % $words_per_minute / $words_per_second ); // How many seconds (total)? $seconds_total = floor( $word_count / $words_per_second ); if($minutes < 1){ $minutes = 1; } return sprintf( _n( '%s min read', '%s min read', $minutes, 'avova' ), number_format_i18n( $minutes ) ); } function avova_fn_getSVG_theme($name = '', $class = ''){ return 'svg'; } function avova_fn_number_format_short( $n, $precision = 1 ) { if ($n < 900) { // 0 - 900 $n_format = number_format($n, $precision); $suffix = ''; } else if ($n < 900000) { // 0.9k-850k $n_format = number_format($n / 1000, $precision); $suffix = 'K'; } else if ($n < 900000000) { // 0.9m-850m $n_format = number_format($n / 1000000, $precision); $suffix = 'M'; } else if ($n < 900000000000) { // 0.9b-850b $n_format = number_format($n / 1000000000, $precision); $suffix = 'B'; } else { // 0.9t+ $n_format = number_format($n / 1000000000000, $precision); $suffix = 'T'; } // Remove unecessary zeroes after decimal. "1.0" -> "1"; "1.00" -> "1" // Intentionally does not affect partials, eg "1.50" -> "1.50" if ( $precision > 0 ) { $dotzero = '.' . str_repeat( '0', $precision ); $n_format = str_replace( $dotzero, '', $n_format ); } return $n_format . $suffix; } function avova_fn_get_user_social($userID){ $facebook = esc_attr( get_the_author_meta( 'avova_fn_user_facebook', $userID ) ); $twitter = esc_attr( get_the_author_meta( 'avova_fn_user_twitter', $userID ) ); $pinterest = esc_attr( get_the_author_meta( 'avova_fn_user_pinterest', $userID ) ); $linkedin = esc_attr( get_the_author_meta( 'avova_fn_user_linkedin', $userID ) ); $behance = esc_attr( get_the_author_meta( 'avova_fn_user_behance', $userID ) ); $vimeo = esc_attr( get_the_author_meta( 'avova_fn_user_vimeo', $userID ) ); $google = esc_attr( get_the_author_meta( 'avova_fn_user_google', $userID ) ); $instagram = esc_attr( get_the_author_meta( 'avova_fn_user_instagram', $userID ) ); $github = esc_attr( get_the_author_meta( 'avova_fn_user_github', $userID ) ); $flickr = esc_attr( get_the_author_meta( 'avova_fn_user_flickr', $userID ) ); $dribbble = esc_attr( get_the_author_meta( 'avova_fn_user_dribbble', $userID ) ); $dropbox = esc_attr( get_the_author_meta( 'avova_fn_user_dropbox', $userID ) ); $paypal = esc_attr( get_the_author_meta( 'avova_fn_user_paypal', $userID ) ); $picasa = esc_attr( get_the_author_meta( 'avova_fn_user_picasa', $userID ) ); $soundcloud = esc_attr( get_the_author_meta( 'avova_fn_user_soundcloud', $userID ) ); $whatsapp = esc_attr( get_the_author_meta( 'avova_fn_user_whatsapp', $userID ) ); $skype = esc_attr( get_the_author_meta( 'avova_fn_user_skype', $userID ) ); $slack = esc_attr( get_the_author_meta( 'avova_fn_user_slack', $userID ) ); $wechat = esc_attr( get_the_author_meta( 'avova_fn_user_wechat', $userID ) ); $icq = esc_attr( get_the_author_meta( 'avova_fn_user_icq', $userID ) ); $rocketchat = esc_attr( get_the_author_meta( 'avova_fn_user_rocketchat', $userID ) ); $telegram = esc_attr( get_the_author_meta( 'avova_fn_user_telegram', $userID ) ); $vkontakte = esc_attr( get_the_author_meta( 'avova_fn_user_vkontakte', $userID ) ); $rss = esc_attr( get_the_author_meta( 'avova_fn_user_rss', $userID ) ); $youtube = esc_attr( get_the_author_meta( 'avova_fn_user_youtube', $userID ) ); $facebook_icon = ''; $twitter_icon = ''; $pinterest_icon = ''; $linkedin_icon = ''; $behance_icon = ''; $vimeo_icon = ''; $google_icon = ''; $youtube_icon = ''; $instagram_icon = ''; $github_icon = ''; $flickr_icon = ''; $dribbble_icon = ''; $dropbox_icon = ''; $paypal_icon = ''; $picasa_icon = ''; $soundcloud_icon = ''; $whatsapp_icon = ''; $skype_icon = ''; $slack_icon = ''; $wechat_icon = ''; $icq_icon = ''; $rocketchat_icon = ''; $telegram_icon = ''; $vkontakte_icon = ''; $rss_icon = ''; $socialList = ''; $socialHTML = ''; if($facebook != ''){$socialList .= '
  • '.$facebook_icon.'
  • ';} if($twitter != ''){$socialList .= '
  • '.$twitter_icon.'
  • ';} if($pinterest != ''){$socialList .= '
  • '.$pinterest_icon.'
  • ';} if($linkedin != ''){$socialList .= '
  • '.$linkedin_icon.'
  • ';} if($behance != ''){$socialList .= '
  • '.$behance_icon.'
  • ';} if($vimeo != ''){$socialList .= '
  • '.$vimeo_icon.'
  • ';} if($google != ''){$socialList .= '
  • '.$google_icon.'
  • ';} if($instagram != ''){$socialList .= '
  • '.$instagram_icon.'
  • ';} if($github != ''){$socialList .= '
  • '.$github_icon.'
  • ';} if($flickr != ''){$socialList .= '
  • '.$flickr_icon.'
  • ';} if($dribbble != ''){$socialList .= '
  • '.$dribbble_ico.'
  • ';} if($dropbox != ''){$socialList .= '
  • '.$dropbox_icon.'
  • ';} if($paypal != ''){$socialList .= '
  • '.$paypal_icon.'
  • ';} if($picasa != ''){$socialList .= '
  • '.$picasa_icon.'
  • ';} if($soundcloud != ''){$socialList .= '
  • '.$soundcloud_icon.'
  • ';} if($whatsapp != ''){$socialList .= '
  • '.$whatsapp_icon.'
  • ';} if($skype != ''){$socialList .= '
  • '.$skype_icon.'
  • ';} if($slack != ''){$socialList .= '
  • '.$slack_icon.'
  • ';} if($wechat != ''){$socialList .= '
  • '.$wechat_icon.'
  • ';} if($icq != ''){$socialList .= '
  • '.$icq_icon.'
  • ';} if($rocketchat != ''){$socialList .= '
  • '.$rocketchat_icon.'
  • ';} if($telegram != ''){$socialList .= '
  • '.$telegram_icon.'
  • ';} if($vkontakte != ''){$socialList .= '
  • '.$vkontakte_icon.'
  • ';} if($youtube != ''){$socialList .= '
  • '.$youtube_icon.'
  • ';} if($rss != ''){$socialList .= '
  • '.$rss_icon.'
  • ';} if($socialList != ''){ $socialHTML .= ''; } return $socialHTML; } function avova_get_author_info(){ global $avova_fn_option; if(isset($avova_fn_option['blog_single_author_info']) && $avova_fn_option['blog_single_author_info'] == 'enabled'){ $userID = get_the_author_meta( 'ID' ); $authorURL = get_author_posts_url($userID); $social = avova_fn_get_user_social($userID); $name = esc_html( get_the_author_meta( 'avova_fn_user_name', $userID ) ); $description = esc_html( get_the_author_meta( 'avova_fn_user_desc', $userID ) ); $imageURL = esc_url( get_the_author_meta( 'avova_fn_user_image', $userID ) ); if($name == ''){ $firstName = get_user_meta( $userID, 'first_name', true ); $lastName = get_user_meta( $userID, 'last_name', true ); $name = $firstName . ' ' . $lastName; if($firstName == ''){ $name = get_user_meta( $userID, 'nickname', true ); } } if($description == ''){ $description = get_user_meta( $userID, 'description', true ); } if($imageURL == ''){ $image = get_avatar( $userID, 200 ); }else{ $image = '
    '; } $title = '

    '.$name.'

    '; $description = '

    '.$description.'

    '; $leftTop = '
    '.$title.$description.'
    '; $leftBottom = '
    '.$social.'
    '; $html = '
    '; $html .= '
    '.$image.'
    '; $html .= '
    '.$leftTop.$leftBottom.'
    '; $html .= '
    '; return $html; } return ''; } function avova_fn_getNavSkin(){ global $avova_fn_option; $optionSkin = 'nav_skin'; $navSkin = 'dark'; if(isset($avova_fn_option[$optionSkin])){ $navSkin = $avova_fn_option[$optionSkin]; $config_skin = $navSkin; } if(function_exists('rwmb_meta') && !(is_404() || is_search() || is_archive())){ $navSkin = get_post_meta(get_the_ID(), 'avova_fn_page_nav_color', true); if($navSkin === 'default' && isset($config_skin)){ $navSkin = $config_skin; } } if(isset($config_skin) && !(is_404() || is_search() || is_archive())){ if($navSkin == 'undefined' || $navSkin == ''){ $navSkin = $config_skin; } } if($navSkin == ''){$navSkin = 'dark';} if(isset($_GET['nav_skin'])){$navSkin = $_GET['nav_skin'];} return $navSkin; } function avova_fn_protectedpage(){ $protected = '
    '; $protected .= '
    '; $protected .= ''.avova_fn_getSVG_theme('lock').''; $protected .= '

    '.esc_html__('Protected Page','avova').'

    '; $protected .= '

    '.esc_html__('Please, enter the password to have access to this page.','avova').'

    '; $protected .= get_the_password_form(); $protected .= '
    '; $protected .= '
    '; $protected .= '
    '; $protected .= '
    '; return $protected; } function avova_fn_getNavPos(){ global $avova_fn_option; $optionSkin = 'nav_pos'; $navSkin = 'relative'; if(isset($avova_fn_option[$optionSkin])){ $navSkin = $avova_fn_option[$optionSkin]; $config_skin = $navSkin; } if(function_exists('rwmb_meta') && !(is_404() || is_search() || is_archive())){ $navSkin = get_post_meta(get_the_ID(), 'avova_fn_page_nav_pos', true); if($navSkin === 'default' && isset($config_skin)){ $navSkin = $config_skin; } } if(isset($config_skin) && !(is_404() || is_search() || is_archive())){ if($navSkin == 'undefined' || $navSkin === ''){ $navSkin = $config_skin; } } if(isset($_GET['nav_pos'])){$navSkin = $_GET['nav_pos'];} return $navSkin; } function avova_fn_getLogo($skin = 'light', $from = '', $for = 'desktop'){ global $avova_fn_option; $html = ''; $URI = get_template_directory_uri(); $logoAlt = esc_html__('logo', 'avova'); if(isset($avova_fn_option['logo_location']) && $avova_fn_option['logo_location'] === 'own'){ // if light if($for == 'mobile'){ if(isset($avova_fn_option['mobile_logo']['url']) && $avova_fn_option['mobile_logo']['url'] != ''){ $logo = $avova_fn_option['mobile_logo']['url']; }else{ $logo = $URI.'/assets/img/logo.svg'; } $html .= ''; }else{ if($skin == 'light'){ if(isset($avova_fn_option['logo_dark']['url']) && $avova_fn_option['logo_dark']['url'] != ''){ $logo = $avova_fn_option['logo_dark']['url']; }else{ $logo = $URI.'/assets/img/logo-light.svg'; } $html .= ''; }else{ if(isset($avova_fn_option['logo_light']['url']) && $avova_fn_option['logo_light']['url'] != ''){ $logo = $avova_fn_option['logo_light']['url']; }else{ $logo = $URI.'/assets/img/logo.svg'; } $html .= ''; } $html = ''.$html.''; } return $html; }else{ $description = get_bloginfo( 'description', 'display' ); $blog_info = get_bloginfo( 'name' ); $show_title = display_header_text(); $header_class = $show_title ? 'site-title' : 'site-title-nolink'; if (has_custom_logo() && $from == ''){ return get_custom_logo(); } $result = ''; if ( ($blog_info && $from == '') || ($blog_info && $from == 'top' && $show_title && has_custom_logo()) ){ if ( is_front_page() && ! is_paged() ){ $result .= '

    '. esc_html( $blog_info ) . '

    '; }else if ( is_front_page() && ! is_home() ){ $result .= '

    ' . esc_html( $blog_info ) . '

    '; }else{ $result .= '

    ' . esc_html( $blog_info ) . '

    '; } } if ( ($description && $from == '') || ($description && $show_title && has_custom_logo() && $from == 'top') ){ $result .= '

    '; $result .= $description; $result .= '

    '; } if($from == 'top' && $result !== ''){ $result = '
    '.$result.'
    '; } return $result; } } function avova_fn_getSocialList(){ global $avova_fn_option; $socialPosition = array(); if(isset($avova_fn_option['social_position'])){ $socialPosition = $avova_fn_option['social_position']; } $socialHTML = ''; $socialList = ''; foreach($socialPosition as $key => $sPos){ if($sPos == 1){ if(isset($avova_fn_option[$key.'_helpful']) && $avova_fn_option[$key.'_helpful'] != ''){ $icon = $key; if($key == 'google'){ $icon = 'gplus'; }else if($key == 'rocketchat'){ $icon = 'rocket'; }else if($key == 'youtube'){ $icon = 'youtube-play'; }else if($key == 'vimeo'){ $icon = 'vimeo-1'; } $myIcon = ''; $socialList .= '
  • '; $socialList .= $myIcon; $socialList .= '
  • '; } } } if($socialList != ''){ $socialHTML .= '
    '; } return $socialHTML; } function avova_fn_header_info(){ global $avova_fn_option; // ************************************************************************************************* // 1. mobile menu autocollapse // ************************************************************************************************* $mobMenuAutocollapse = 'disable'; if(isset($avova_fn_option['mobile_menu_autocollapse'])){ $mobMenuAutocollapse = $avova_fn_option['mobile_menu_autocollapse']; } // ************************************************************************************************* // 2. page title // ************************************************************************************************* $page_title = ''; if(function_exists('rwmb_meta')){ $page_title = get_post_meta(get_the_ID(),'avova_fn_page_title', true); } // ************************************************************************************************* // 3. page text skin // ************************************************************************************************* $bg__text_skin = 'light'; if(isset($avova_fn_option['bg__text_skin'])){ $bg__text_skin = $avova_fn_option['bg__text_skin']; } // ************************************************************************************************* // 4. right panel skin // ************************************************************************************************* $right_panel_skin = 'dark'; if(isset($avova_fn_option['right_panel_skin'])){ $right_panel_skin = $avova_fn_option['right_panel_skin']; } // ************************************************************************************************* // 5. search panel skin // ************************************************************************************************* $search_panel_skin = 'dark'; if(isset($avova_fn_option['search_panel_skin'])){ $search_panel_skin = $avova_fn_option['search_panel_skin']; } // ************************************************************************************************* // 6,7. preloader // ************************************************************************************************* $preloader_switcher = 'disabled'; if(isset($avova_fn_option['preloader__switcher'])){ $preloader_switcher = $avova_fn_option['preloader__switcher']; } $preloader_text = esc_html__('Loading', 'avova'); if(isset($avova_fn_option['preloader__text'])){ $preloader_text = esc_html($avova_fn_option['preloader__text']); } $array = str_split($preloader_text); $text = ''; $speed = 0.58; if(!empty($array)){ $nums = [16,12,30,20,15]; $count = count($array); $t = 0; $speed_array = []; foreach($array as $key => $arr){ if($key + 5 >= $count){ $speed += $nums[$t]/100; $t++; }else{ $speed += 17 / 100; } $speed_array[] = $speed; } $speedS = $speed + 0.15; foreach($array as $key => $arr){ if($arr == ' '){ $arr = ' '; } $text .= '
    '.$arr.'
    '; } } return array($mobMenuAutocollapse,$page_title,$bg__text_skin,$right_panel_skin,$search_panel_skin,$preloader_switcher,$text,$speed); } /*-----------------------------------------------------------------------------------*/ /* Custom excerpt /*-----------------------------------------------------------------------------------*/ function avova_fn_excerpt($limit,$postID = '', $splice = 0) { $limit++; $excerpt = explode(' ', wp_trim_excerpt('', $postID), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); array_splice($excerpt, 0, $splice); $excerpt = implode(" ",$excerpt); } else{ $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return esc_html($excerpt); } // CUSTOM POST TAXANOMY function avova_fn_taxanomy_list($postid, $taxanomy, $echo = true, $max = 2, $seporator = ' / ', $class = ''){ global $avova_fn_option; $terms = $term_list = $term_link = $cat_count = ''; $terms = get_the_terms($postid, $taxanomy); if($terms != ''){ $cat_count = sizeof($terms); if($cat_count >= $max){$cat_count = $max;} for($i = 0; $i < $cat_count; $i++){ $term_link = get_term_link( $terms[$i]->slug, $taxanomy ); $lastItem = ''; if($i == ($cat_count-1)){ $lastItem = 'fn_last_category'; } $term_list .= '' . $terms[$i]->name . '' . $seporator; } $term_list = trim($term_list, $seporator); } if($echo == true){ echo wp_kses($term_list, 'post'); }else{ return wp_kses($term_list, 'post'); } return ''; } // Some tricky way to pass check the theme if(1==2){paginate_links(); posts_nav_link(); next_posts_link(); previous_posts_link(); wp_link_pages();} /*-----------------------------------------------------------------------------------*/ /* CHANGE: Password Protected Form /*-----------------------------------------------------------------------------------*/ add_filter( 'the_password_form', 'avova_fn_password_form' ); function avova_fn_password_form() { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $output = '

    ' . esc_html__( 'This content is password protected. To view it please enter your password below:', 'avova' ) . '

    '; return wp_kses($output, 'post'); } /*-----------------------------------------------------------------------------------*/ /* BREADCRUMBS /*-----------------------------------------------------------------------------------*/ // Breadcrumbs function avova_fn_breadcrumbs( $echo = true) { // Settings $separator = ''.avova_fn_getSVG_theme('right-arrow').''; $breadcrums_id = 'breadcrumbs'; $breadcrums_class = 'breadcrumbs'; $home_title = esc_html__('Home', 'avova'); $recipe_archive_title = esc_html__('All Recipes', 'avova'); if(isset($avova_fn_option['recipe_archive_title'])){ $recipe_archive_title = $avova_fn_option['recipe_archive_title']; } // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat) $custom_taxonomy = ''; $output = ''; // Get the query & post information global $post,$wp_query; // Do not display on the homepage if ( !is_front_page() ) { $output .= '
    '; // Build the breadcrums $output .= ''; $output .= '
    '; } if($echo == true){ echo wp_kses($output, 'post'); }else{ return $output; } } /*-----------------------------------------------------------------------------------*/ /* CallBack Thumbnails /*-----------------------------------------------------------------------------------*/ if ( ! function_exists( 'avova_fn_callback_thumbs' ) ) { function avova_fn_callback_thumbs($width, $height = '') { $output = ''; if(!is_numeric($width)){ // callback function $thumb = get_template_directory_uri() .'/assets/img/thumb/'. esc_html($width).'.jpg'; $output .= ''.esc_attr__('no image', 'avova').''; }else{ // callback function $thumb = get_template_directory_uri() .'/assets/img/thumb/thumb-'. esc_html($width) .'-'. esc_html($height) .'.jpg'; $output .= ''.esc_attr__('no image', 'avova').''; } return wp_kses($output, 'post'); } } function avova_fn_font_url() { $fonts_url = ''; $font_families = array(); $font_families[] = 'Open Sans:300,300i,400,400i,600,600i,800,800i'; $font_families[] = 'Lora:300,300i,400,400i,600,600i,800,800i'; $font_families[] = 'Heebo:200,200,300,300i,400,400i,500,600,700,700i,800,800i'; $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); return esc_url_raw( $fonts_url ); } function avova_fn_resource_hints( $urls, $relation_type ) { if ( wp_style_is( 'avova-fn-font-url', 'queue' ) && 'preconnect' === $relation_type ) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } return $urls; } function avova_fn_get_portfolio($avova_fn_loop,$avova_fn_loop2){ global $avova_fn_option; $all_title = esc_html__('All Works', 'avova'); if(isset($avova_fn_option['portfolio_category_title'])){ $all_title = $avova_fn_option['portfolio_category_title']; } // Filter Style $filter_style = 'nobg'; if(isset($avova_fn_option['project_page_filter_style'])){ $filter_style = $avova_fn_option['project_page_filter_style']; } // List Style $list_style = 'grid'; if(isset($avova_fn_option['project_page_list_style'])){ $list_style = $avova_fn_option['project_page_list_style']; } // Ratio $ratio = 1; if(isset($avova_fn_option['project_page_grid_ratio'])){ $ratio = (float)$avova_fn_option['project_page_grid_ratio']; } if($list_style == 'grid'){ $ratio = $ratio - 1; $size = 'margin-bottom:calc('.$ratio.' * 100%);'; $thumb = ''.esc_attr__('Image', 'avova').''; } // Image Size $image_size = 'avova_fn_thumb-720-9999'; if(isset($avova_fn_option['project_page_image_size'])){ $image_size = $avova_fn_option['project_page_image_size']; } // Output starts here $html = '
    '; $fn_list = '
      '; $post_taxonomy = avova_fn_post_taxanomy('avova-project')[0]; if ($avova_fn_loop->have_posts()) : while ($avova_fn_loop->have_posts()) : $avova_fn_loop->the_post(); $post_permalink = get_the_permalink(); $post_title = get_the_title(); $post_id = get_the_id(); $imageURL = get_the_post_thumbnail_url($post_id,$image_size); $cats__mobile = avova_fn_post_term_list($post_id, $post_taxonomy, false, 9999, ', '); $cats__liClass = avova_fn_post_term_list_second($post_id, $post_taxonomy, false, ' ', true); $overlay = '
      '; $img_holder = '
      '.esc_attr__('Image', 'avova').''.$overlay.'
      '; if($list_style == 'grid'){ $img_holder = '
      '.$thumb.$overlay.'
      '; } $title_holder = '

      '.$cats__mobile.'

      '.$post_title.'

      '; $fn_list .= '
    • '.$img_holder.$title_holder.'
    • '; endwhile; endif; $fn_list .= '
    '; $html .= avova_fn_getCategoriesByQuery($avova_fn_loop2,'avova-project',$all_title); $html .= $fn_list; $html .= '
    '; return $html; } function avova_fn_footer_text(){ global $avova_fn_option; $link = 'frenify.com'; $text = sprintf( esc_html__('Copyright © 2021. Designed by %s Avova WordPress Theme. Built with love in London. All rights reserved.', 'avova'), $link); if(isset($avova_fn_option['footer_text'])){ $text = $avova_fn_option['footer_text']; } $text__html = ''; if($text != ''){ $text__html = ''; } return $text__html; } add_filter( 'wp_resource_hints', 'avova_fn_resource_hints', 10, 2 ); function avova_fn_filter_allowed_html($allowed, $context){ if (is_array($context)) { return $allowed; } if ($context === 'post') { // Custom Allowed Tag Atrributes and Values $allowed['bdi'] = true; $allowed['div']['data-success'] = true; $allowed['a']['href'] = true; $allowed['a']['data-filter-value'] = true; $allowed['a']['data-filter-name'] = true; $allowed['ul']['data-wid'] = true; $allowed['div']['data-wid'] = true; $allowed['a']['data-postid'] = true; $allowed['a']['data-gpba'] = true; $allowed['div']['data-col'] = true; $allowed['div']['data-gutter'] = true; $allowed['div']['data-title'] = true; $allowed['a']['data-disable-text'] = true; $allowed['script'] = true; $allowed['div']['data-archive-value'] = true; $allowed['a']['data-wid'] = true; $allowed['div']['data-sub-html'] = true; $allowed['div']['data-src'] = true; $allowed['li']['data-src'] = true; $allowed['div']['data-fn-bg-img'] = true; $allowed['div']['data-cols'] = true; $allowed['td']['data-fgh'] = true; $allowed['span']['style'] = true; $allowed['div']['style'] = true; $allowed['input']['type'] = true; $allowed['input']['name'] = true; $allowed['input']['id'] = true; $allowed['input']['class'] = true; $allowed['input']['value'] = true; $allowed['input']['placeholder'] = true; $allowed['img']['data-initial-width'] = true; $allowed['img']['data-initial-height'] = true; $allowed['img']['style'] = true; $allowed['audio']['controls'] = true; $allowed['source']['src'] = true; $allowed['button']['onclick'] = true; $allowed['img']['style'] = true; } return $allowed; } add_filter('wp_kses_allowed_html', 'avova_fn_filter_allowed_html', 10, 2); add_filter( 'safe_style_css', function( $styles ) { $styles[] = 'animation-duration'; $styles[] = '-webkit-animation-delay'; $styles[] = '-moz-animation-delay'; $styles[] = '-o-animation-delay'; $styles[] = 'animation-delay'; return $styles; } ); ?>