array( 'name' => 'USD', 'rate' => 1, 'symbol' => '$', 'position' => 'right', 'is_etalon' => 1, 'description' => 'USA dollar', 'hide_cents' => 0, 'flag' => '', ), 'EUR' => array( 'name' => 'EUR', 'rate' => 0.89, 'symbol' => '€', 'position' => 'left_space', 'is_etalon' => 0, 'description' => 'European Euro', 'hide_cents' => 0, 'flag' => '', ) ); $currencies = get_option('woocs', $default); $currencies = apply_filters('adela_woocs_currency_data_manipulation', $currencies); if (empty($currencies) OR ! is_array($currencies)) { $currencies = $default; } if (count($currencies) < 2) { $currencies = $default; } if (count($currencies) > 2) { $currencies = $default; } return $currencies; } } if( !function_exists( 'adela_woocs_currencies_switcher' ) ){ function adela_woocs_currencies_switcher() { if( adela_is_plugin_activated() && class_exists( 'WOOCS_STARTER' ) ){ $object_woocs = new WOOCS(); $current_currency = $object_woocs->current_currency; $all_currencies = adela_woocs_get_currencies(); ?>
ID, $meta_key, true ); if ( ! empty( $field ) ) { return $field; } else { return $default; } } } if( !function_exists( 'adela_body_class' ) ){ function adela_body_class( $classes ){ if( is_page() ){ $page_class = ''; $adela_page_layout = adela_get_post_meta( '_adela_page_layout', 'right' ); if( $adela_page_layout == 'full' ){ $page_class = 'site_page_layout site_fullwidth'; }else{ $page_class = 'site_page_layout site_' . $adela_page_layout . '_sidebar'; } $classes[] = $page_class; }else{ if( function_exists( 'is_woocommerce' ) && is_woocommerce() ){ }else{ $adela_blog_layout = adela_get_option( 'blog_site_layout', 'right' ); $site_class = ''; if( $adela_blog_layout == 'full' ){ $site_class = 'site_layout site_fullwidth'; }else{ $site_class = 'site_layout site_' . $adela_blog_layout . '_sidebar'; } $classes[] = $site_class; } } if ( ! is_singular() ) { $classes[] = 'hfeed'; } return $classes; } } add_filter( 'body_class', 'adela_body_class' ); function adela_cat_count_span( $links ) { $links = str_replace( ' (', '(', $links ); $links = str_replace( ')', ')', $links ); return $links; } add_filter( 'wp_list_categories', 'adela_cat_count_span' ); function adela_archive_count_span( $links ) { $links = str_replace( ' (', '(', $links ); $links = str_replace( ')', ')', $links ); return $links; } add_filter( 'get_archives_link', 'adela_archive_count_span' ); if ( !function_exists( 'adela_resize_image' ) ) { /** * @param int $attach_id * @param string $img_url * @param int $width * @param int $height * @param bool $crop * @param bool $use_lazy * * @since 1.0 * @return array */ function adela_resize_image( $attach_id = null, $img_url = null, $width, $height, $crop = false, $place_hold = true, $use_real_img_hold = true, $solid_img_color = null ) { /*If is singular and has post thumbnail and $attach_id is null, so we get post thumbnail id automatic*/ if ( is_singular() && !$attach_id ) { if ( has_post_thumbnail() && !post_password_required() ) { $attach_id = get_post_thumbnail_id(); } } /*this is an attachment, so we have the ID*/ $image_src = array(); if ( $attach_id ) { $image_src = wp_get_attachment_image_src( $attach_id, 'full' ); $actual_file_path = get_attached_file( $attach_id ); /*this is not an attachment, let's use the image url*/ } else if ( $img_url ) { $file_path = str_replace( get_site_url(), get_home_path(), $img_url ); $actual_file_path = rtrim( $file_path, '/' ); if ( !file_exists( $actual_file_path ) ) { $file_path = parse_url( $img_url ); $actual_file_path = rtrim( ABSPATH, '/' ) . $file_path['path']; } if ( file_exists( $actual_file_path ) ) { $orig_size = getimagesize( $actual_file_path ); $image_src[0] = $img_url; $image_src[1] = $orig_size[0]; $image_src[2] = $orig_size[1]; } else{ $image_src[0] = ''; $image_src[1] = 0; $image_src[2] = 0; } } if ( ! empty( $actual_file_path ) && file_exists( $actual_file_path ) ) { $file_info = pathinfo( $actual_file_path ); $extension = '.' . $file_info['extension']; /*the image path without the extension*/ $no_ext_path = $file_info['dirname'] . '/' . $file_info['filename']; $cropped_img_path = $no_ext_path . '-' . $width . 'x' . $height . $extension; /*checking if the file size is larger than the target size*/ /*if it is smaller or the same size, stop right here and return*/ if ( $image_src[1] > $width || $image_src[2] > $height ) { /*the file is larger, check if the resized version already exists (for $crop = true but will also work for $crop = false if the sizes match)*/ if ( file_exists( $cropped_img_path ) ) { $cropped_img_url = str_replace( basename( $image_src[0] ), basename( $cropped_img_path ), $image_src[0] ); $vt_image = array( 'url' => $cropped_img_url, 'width' => $width, 'height' => $height ); return $vt_image; } if ( $crop == false ) { /*calculate the size proportionaly*/ $proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height ); $resized_img_path = $no_ext_path . '-' . $proportional_size[0] . 'x' . $proportional_size[1] . $extension; /*checking if the file already exists*/ if ( file_exists( $resized_img_path ) ) { $resized_img_url = str_replace( basename( $image_src[0] ), basename( $resized_img_path ), $image_src[0] ); $vt_image = array( 'url' => $resized_img_url, 'width' => $proportional_size[0], 'height' => $proportional_size[1] ); return $vt_image; } } /*no cache files - let's finally resize it*/ $img_editor = wp_get_image_editor( $actual_file_path ); if ( is_wp_error( $img_editor ) || is_wp_error( $img_editor->resize( $width, $height, $crop ) ) ) { return array( 'url' => '', 'width' => '', 'height' => '' ); } $new_img_path = $img_editor->generate_filename(); if ( is_wp_error( $img_editor->save( $new_img_path ) ) ) { return array( 'url' => '', 'width' => '', 'height' => '' ); } if ( ! is_string( $new_img_path ) ) { return array( 'url' => '', 'width' => '', 'height' => '' ); } $new_img_size = getimagesize( $new_img_path ); $new_img = str_replace( basename( $image_src[0] ), basename( $new_img_path ), $image_src[0] ); /*resized output*/ $vt_image = array( 'url' => $new_img, 'width' => $new_img_size[0], 'height' => $new_img_size[1] ); return $vt_image; } /*default output - without resizing*/ $vt_image = array( 'url' => $image_src[0], 'width' => $image_src[1], 'height' => $image_src[2] ); return $vt_image; } else { if ( $place_hold ) { $width = intval( $width ); $height = intval( $height ); /*Real image place hold (https://unsplash.it/)*/ if ( $use_real_img_hold ) { $random_time = time() + rand( 1, 100000 ); $vt_image = array( 'url' => 'https://unsplash.it/' . $width . '/' . $height . '?random&time=' . $random_time, 'width' => $width, 'height' => $height ); } else{ $vt_image = array( 'url' => 'http://placehold.it/' . $width . 'x' . $height, 'width' => $width, 'height' => $height ); } return $vt_image; } } return false; } } if( !function_exists( 'adela_post_thumbnail' ) ){ function adela_post_thumbnail(){ global $post; $thumb_width = '1170'; $thumb_height = '700'; $blog_layout = adela_get_option( 'blog_site_layout', 'right' ); $blog_type = adela_get_option( 'blog_display_style', 'list' ); if( $blog_type == 'list' || is_single() ){ if( $blog_layout != 'full' ){ $thumb_width = '870'; $thumb_height = '580'; } }else if( $blog_type == 'grid' ){ if( $blog_layout != 'full' ){ $thumb_width = '420'; $thumb_height = '320'; }else{ $thumb_width = '370'; $thumb_height = '247'; } }else{ $thumb_width = '370'; $thumb_height = '247'; } if( has_post_thumbnail( $post->ID ) && function_exists( 'the_post_thumbnail' ) ){ ?>
ID ), null, $thumb_width, $thumb_height, true, false, false, null ); if( isset( $thumb_image['url'] ) && $thumb_image['url'] != '' ){ ?> <?php echo the_title_attribute( array( 'echo' => false ) ); ?> <?php echo the_title_attribute( array( 'echo' => false ) ); ?>
2, 'screen_reader_text' => '', 'prev_text' => '', 'next_text' => '', )); } } if( !function_exists('adela_custom_comment') ){ function adela_custom_comment($comment, $args, $depth){ if ( 'div' === $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } ?> < id="comment-">
%s' ,'adela'), get_comment_author() ); ?>
comment_approved == '0' ) : ?>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
trail(); } } } if ( ! function_exists( 'adela_header_style' ) ) { function adela_header_style() { $header_text_color = get_header_textcolor(); $header_image = get_header_image(); if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) { return; } ?>