%PDF- %PDF-
Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/templates/ |
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/templates/portfolio-loop.php |
<?php // File Security Check if ( ! defined( 'ABSPATH' ) ) { exit; } global $post; $config = Levelup_Config::get_instance(); $link_class = $overlay_div = $link_href = $link_href2 = $link_class = $link_class2 = $media = $video_src = ''; $subtitle = get_post_meta($post->ID, '_rdy_portfolio_subtitle', true); $hover_color = get_post_meta($post->ID, '_rdy_portfolio_hover_color', true); $link = get_post_meta($post->ID, '_rdy_portfolio_link', true); $link_target_blank = get_post_meta($post->ID, '_rdy_portfolio_link_target_blank', true); $item_bg_color = get_post_meta($post->ID, '_rdy_portfolio_item_bg_color', true); if ( !$config->get('gallery') ) { $link_href = $link ? $link : get_permalink($post->ID); $link_href2 = $link ? $link : get_permalink($post->ID); } if ( !$hover_color ) { $hover_color = $config->get('hover_color'); } if ( $hover_color ) { $overlay_div = '<div class="overlay" style="background-color:' . esc_attr( $hover_color ) . ';"></div>'; } if ( $config->get('type') != 'grid_adv' ) { $video_mp4_attachment_id = get_post_meta($post->ID, '_rdy_portfolio_video_mp4', true); //$video = wp_get_attachment_metadata( $video_mp4_attachment_id ); $video_src = wp_get_attachment_url( $video_mp4_attachment_id ); } $background_item = ''; if ( $item_bg_color ) { $background_item = ' style="background:' . esc_attr( $item_bg_color ) . ';"'; } if ( (has_post_thumbnail() || $video_src) && $config->get('gallery') ) { $thumb_meta_link = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); wp_enqueue_script('magnific_popup'); wp_enqueue_style('magnific_popup'); $popup_link = $video_src ? $video_src : $thumb_meta_link[0]; $popup_class = $video_src ? 'rdy-video-lightbox' : 'mfp-lightbox'; if ( in_array($config->get('hover_type'), array(1, 2, 3, 4, 5, 6)) ) { $link_class2 = $popup_class; $link_href2 = $popup_link; } else { $link_class = $popup_class; } $link_href = $popup_link; } $thumb_id = ''; if ( has_post_thumbnail() ) { $image_ratio = 1; $thumb_id = get_post_thumbnail_id(); $original = wp_get_attachment_image_src( $thumb_id, 'full' ); $attachment_type = get_post_mime_type($thumb_id); if ( $attachment_type == 'image/gif' ) { $thumb_meta = $original; } else { if ($original && !empty($original[2])) { $image_ratio = $original[1] / $original[2]; } if ( $config->get('large_image') || $config->get('type') == 'grid_adv' ) { $portfolio_thumb_orig = 'levelup-portfolio-big-thumb-orig'; $portfolio_thumb_square = 'levelup-portfolio-big-thumb-square'; $portfolio_thumb = 'levelup-portfolio-big-thumb'; } else { $portfolio_thumb_orig = 'levelup-portfolio-thumb-orig'; $portfolio_thumb_square = 'levelup-portfolio-thumb-square'; $portfolio_thumb = 'levelup-portfolio-thumb'; } if ( $config->get('type') == 'grid' && $config->get('square_image') ) { $thumb_meta = wp_get_attachment_image_src($thumb_id, $portfolio_thumb_square); } elseif ( $config->get('type') == 'grid' || $config->get('type') == 'animation1' ) { $thumb_meta = wp_get_attachment_image_src($thumb_id, $portfolio_thumb); } elseif ( $config->get('type') == 'grid_adv' ) { $thumb_meta = wp_get_attachment_image_src($thumb_id, $portfolio_thumb); } elseif ( $config->get('type') == 'height' ) { $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full'); } else { if ($image_ratio < 0.8) { $thumb_meta = wp_get_attachment_image_src($thumb_id, 'levelup-portfolio-big-thumb-orig'); } else { $thumb_meta = wp_get_attachment_image_src($thumb_id, $portfolio_thumb_orig); } } } $link_wrap = '<a %CLASS% %HREF% %TITLE% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %SIZE%/>' . $overlay_div . '</a>'; if ( $attachment_type == 'image/gif' ) { $img_class = ' img-gif'; $img_div_placeholder = ''; if ( $config->get('type') == 'grid' && $config->get('square_image') ) { $img_class = ' img-gif-square'; $img_div_placeholder = '<span class="portfolio-image-responsive-size"></span>'; } $link_wrap = '<a %CLASS% %HREF% %TITLE% %CUSTOM%>'. $img_div_placeholder . '<div class="img' . $img_class . '"' . $background_item . '><img %IMG_CLASS% %SRC% %ALT% %SIZE%/></div>'.$overlay_div.'</a>'; } $thumb_args = array( 'img_meta' => $thumb_meta, 'img_id' => $thumb_id, 'img_class' => 'preload-me', 'class' => $link_class, 'href' => $link_href, 'wrap' => $link_wrap, 'echo' => false, ); if ($link_target_blank) { $thumb_args['custom'] = 'target="_blank"'; } $thumb_args = apply_filters( 'rdy_portfolio_thumbnail_args', $thumb_args ); $media = levelup_get_thumb_img( $thumb_args ); } if ( $video_src ) { $video_html = '<video class="video-js" preload="auto" width="100%" height="100%" autoplay="true" loop><source src="' . esc_url($video_src) . '" type="video/mp4"></video> </div>'; $img_class = ' img-gif'; $img_div_placeholder = ''; if ( $config->get('type') == 'grid' && $config->get('square_image') ) { $img_class = ' img-gif-square'; $img_div_placeholder = '<span class="portfolio-image-responsive-size"></span>'; } if( $config->get('type') == 'height' ) { $media = '<a class="'.$link_class.'" href="'.$link_href.'"><div class="img' . $img_class . '"' . $background_item . '>' . $video_html . '</a>'; } else if( $config->get('type') == 'grid_adv' ) { $media = '<a class="'.$link_class.'" href="'.$link_href.'"><div class="img' . $img_class . '"' . $background_item . '>' . $video_html . '</a>'; } else { $media = '<a class="'.$link_class.'" href="'.$link_href.'">' . $img_div_placeholder . '</span><div class="img' . $img_class . '"' . $background_item . '> ' . $video_html . $overlay_div . '</a>'; } } $classes = array('post'); $classes_div = array(); $classes_div[] = 'item-' . $post->ID; $classes_div[] = 'isotope-item'; $classes_div[] = 'grid-item'; if ( $config->get('items_animation') ) { $classes_div[] = 'do-animation'; } if ($config->get('type') == 'grid_adv') { if ($config->get('adv_pattern') == 1) { if (in_array($item_count, array(1, 8))) { $classes_div[] = 'wide-tall'; } elseif (in_array($item_count, array(3, 7))) { $classes_div[] = 'tall'; } } elseif ($config->get('adv_pattern') == 2) { if (in_array($item_count, array(0, 7))) { $classes_div[] = 'wide-tall'; } } elseif ($config->get('adv_pattern') == 3) { if (in_array($item_count, array(0))) { $classes_div[] = 'wide-tall'; } } elseif ($config->get('adv_pattern') == 4) { if (in_array($item_count, array(0, 6, 12))) { $classes_div[] = 'wide-tall'; } } elseif ($config->get('adv_pattern') == 5) { if (in_array($item_count, array(0))) { $classes_div[] = 'wide-tall'; } } } elseif ($config->get('type') == 'height') { $classes_div[] = 'col-xs-12'; } else { $classes_div[] = levelup_calc_columns_class($config->get('columns')); } $tax = 'rdy_portfolio_category'; $terms = wp_get_object_terms( $post->ID, $tax, array('fields' => 'ids') ); if ( $terms && !is_wp_error($terms) ) { foreach ( $terms as $term_id ) { $classes_div[] = 'category-' . $term_id; } } else { $classes_div[] = 'category-0'; } $skrollr_animation = false; if ( $config->get('type') == 'animation1' ) { $skrollr_animation = true; if ($item_count % 2) { $animate_y = '0'; } else { $animate_y = '50'; } $animation_data = ' data-top-bottom="transform: translateY(' . esc_attr( $animate_y ) . '%)" data-bottom-top="transform: translateY(-' . esc_attr( $animate_y ) . '%)"'; } $title_style = $subtitle_style = ''; if ( $config->get('use_custom_font') ) { if ($config->get('title_fontsize')) { $title_style .= 'font-size: ' . esc_attr( $config->get('title_fontsize') ) . 'px; line-height: 120% !important; '; } if ($config->get('subtitle_fontsize')) { $subtitle_style .= 'font-size: ' . esc_attr( $config->get('subtitle_fontsize') ) . 'px; line-height: 120% !important; '; } if ($config->get('title_font_color')) { $title_style .= 'color: ' . esc_attr( $config->get('title_font_color') ) . ';'; } if ($config->get('subtitle_font_color')) { $subtitle_style .= 'color: ' . esc_attr( $config->get('subtitle_font_color') ) . ';'; } } $background_image = isset($thumb_meta) && empty($video_src) ? 'background-image:url(' . esc_url($thumb_meta[0]) . ');' : ''; ?> <div class="<?php echo levelup_sanitize_classes( $classes_div ); ?>"> <article <?php post_class( levelup_sanitize_classes( $classes ) ); ?><?php if ($skrollr_animation): ?> data-animated="1" data-count="<?php echo esc_attr( $item_count );?>"<?php echo $animation_data;?><?php endif;?>> <div class="grid"> <?php if (in_array($config->get('type'), array('grid', 'masonry', 'grid_adv', 'animation1'))):?> <figure> <?php /*if ( $config->get('hover_type') == '4' ): ?><a class="mainlink<?php echo $popup_class ? ' ' . esc_attr ( $popup_class ) : ''; ?>" href="<?php echo esc_url( $link_href2 ); ?>"<?php if ($link_target_blank) { echo ' target="_blank"'; }?>></a><?php endif;*/ ?> <div class="picture"> <?php if ( $config->get('type') == 'grid_adv' ): ?> <div class="item-content img" style="<?php echo $background_image;?>"><?php if ( $media && $video_src ) echo $media; ?><?php echo $overlay_div;?></div> <?php echo $overlay_div;?> <?php else: ?> <?php if ( $media ) { echo $media ; } ?> <?php endif; ?> </div> <?php if ( $link_href2 && ( $config->get('hover_type') == 10 || $config->get('hover_type') == 11 ) ) { ?><a class="link" href="<?php echo esc_url( $link_href2 );?>"<?php if ($link_target_blank) echo ' target="_blank"'; ?>></a><?php } ?> <?php if ($link_href2):?> <a class="<?php if ($config->get('title_bottom')){ echo 'figcaption_wrap '; } if ($config->get('hover_type') == 6):?>label <?php endif;?><?php echo esc_attr( $link_class2 ); ?>" href="<?php echo esc_url( $link_href2 ); ?>"<?php if ($link_target_blank) echo ' target="_blank"';?>> <?php else:?> <?php if (!$link_href2 && $config->get('title_bottom')):?><div class="figcaption_wrap"><?php endif;?> <?php if ($config->get('hover_type') == 6):?><div class="label"><?php endif;?> <?php endif;?> <?php if ($config->get('hover_type') == 6):?> <div class="label_body"><div class="label_fill"<?php if ($hover_color) { echo ' style="background: ' . esc_attr( $hover_color ) . ';"';}?>></div> <?php endif;?> <div class="figcaption<?php if (!$config->get('show_titles')):?> only_title<?php endif;?>"<?php if ( $config->get('title_bottom') ){ echo ' style="padding:0;bottom:' . esc_attr( $config->get('title_bottom') ) . '%"'; }?>> <div class="col-table"> <div class="col-td"> <?php if ( !$config->get('hide_title') ):?><h2<?php echo ($title_style ? ' style="' . esc_attr( $title_style ) . '"' : ''); ?>><?php the_title(); ?></h2><?php endif;?> <?php if ( !$config->get('hide_subtitle') && $subtitle ):?><p class="description"<?php echo ($subtitle_style ? ' style="' . esc_attr( $subtitle_style ) . '"' : '');?>><?php echo esc_html( $subtitle );?></p><?php endif;?> </div> </div> </div> <?php if ( $config->get('hover_type') == 6 ): ?></div><?php endif;?> <?php if ($link_href2) {?> </a> <?php } else {?> <?php if ( !$link_href2 && $config->get('title_bottom') ): ?></div><?php endif;?> <?php if ( $config->get('hover_type') == 6 ): ?></div><?php endif;?> <?php } ?> </figure> <?php elseif ($config->get('type') == 'height'): ?> <figure> <div class="picture"> <div class="item-content img" style="<?php echo 'min-height: ' . esc_attr( $config->get('height') ) . 'px;' . ( $config->get('dynamic_height') ? 'height: ' . esc_attr( $config->get('dynamic_height') ) . 'vh;' : '' );?><?php echo $background_image;?>"><?php if ( $media && $video_src ) echo $media; ?></div> <?php if ( $hover_color ) { echo '<div class="overlay" style="background-color:' . esc_attr( $hover_color ) . ';"></div>'; }?> </div> <?php if ( $link_href2 ) { ?> <a class="<?php if ( $config->get('title_bottom') ) { echo 'figcaption_wrap '; } if ( $config->get('hover_type') == 6 ):?>label <?php endif;?><?php echo esc_attr( $link_class2 );?>" href="<?php echo esc_url( $link_href2 );?>"<?php if ( $link_target_blank ) echo ' target="_blank"';?>> <?php } else { ?> <?php if ( !$link_href2 && $config->get('title_bottom')): ?><div class="figcaption_wrap"><?php endif;?> <?php } ?> <div class="figcaption<?php if ( !$config->get('show_titles') ): ?> only_title<?php endif;?>"<?php if ( $config->get('title_bottom') ){ echo ' style="padding:0;bottom:' . esc_attr( $config->get('title_bottom') ) . '%"'; }?>> <div class="col-table"> <div class="col-td"> <div class="title_wrap"> <?php if ( !$config->get('hide_title') ): ?><h2<?php echo ($title_style ? ' style="' . esc_attr( $title_style ) . '"' : ''); ?>><?php the_title(); ?></h2><?php endif;?> <?php if ( !$config->get('hide_subtitle') && $subtitle ): ?><p class="description"<?php echo ($subtitle_style ? ' style="' . esc_attr( $subtitle_style ) . '"' : '');?>><?php echo esc_html( $subtitle ); ?></p><?php endif;?> </div> </div> </div> </div> <?php if ( $link_href2 ){ ?> </a> <?php } else { ?> <?php if ( !$link_href2 && $config->get('title_bottom') ): ?></div><?php endif;?> <?php } ?> </figure> <?php endif;?> </div> </article><!-- #post-<?php the_ID(); ?> --> </div>