%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/gallery-loop.php |
<?php // File Security Check if ( ! defined( 'ABSPATH' ) ) { exit; } global $post; $config = Levelup_Config::get_instance(); $overlay_div = '<div class="overlay"' . ( $config->get('hover_color') ? ' style="background-color:' . esc_attr( $config->get('hover_color') ) . '"' : '' ) . '></div>'; $link_class = $link_href = $link_href2 = $link_class2 = $use_ext_link = ''; $thumb_id = $post->ID; $original = wp_get_attachment_image_src( $thumb_id, 'full' ); $attachment_type = get_post_mime_type($thumb_id); $image_ratio = 1; if ($original && !empty($original[2])) { $image_ratio = $original[1] / $original[2]; } if ( $attachment_type == 'image/gif' ) { $thumb_meta = $original; } else { if ( $config->get( 'columns' ) == 2 || $config->get( 'type' ) == 'adv_grid' ) { $portfolio_thumb_orig = 'levelup-portfolio-big-thumb-orig'; $portfolio_thumb_square = 'levelup-portfolio-big-thumb-square'; $portfolio_thumb = 'levelup-portfolio-big-thumb'; } else if ( $config->get( 'columns' ) == 1 ) { $portfolio_thumb_orig = 'full'; $portfolio_thumb_square = 'full'; $portfolio_thumb = 'full'; } 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') { $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); } 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); } } } $image_title = ''; $image = get_post($thumb_id); $image_title = $image->post_excerpt; if ( !$config->get('no_link') ) { $thumb_meta_link = wp_get_attachment_image_src($thumb_id, 'full'); wp_enqueue_script('magnific_popup'); wp_enqueue_style('magnific_popup'); if (in_array($config->get('hover_type'), array(1, 2, 3, 4, 6))) { $link_class2 = ''; $link_href2 = $thumb_meta_link[0]; } else { $link_class = ''; } $link_href = $thumb_meta_link[0]; } else if ( $config->get('use_ext_link') ) { $link_href = get_post_meta( $thumb_id, '_link', true ); $link_href2 = $link_href; $use_ext_link = $link_href ? true : false; } $thumb_wrap = '<a %CLASS% %HREF% %TITLE% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %SIZE% %CUSTOM%/>' . $overlay_div . '</a>'; if ( $config->get( 'type' ) == 'grid_adv' ) { $thumb_wrap = '<img %IMG_CLASS% %SRC% %ALT% %SIZE% />'; } else if ( ! $link_href2 ) { $thumb_wrap = '<a %CLASS% %TITLE% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %SIZE% %CUSTOM%/>' . $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' => $thumb_wrap, 'echo' => false, 'title' => $image_title ? $image_title : '', 'custom' => $use_ext_link && $config->get('use_link_blank') ? 'target="_blank"' : '', ); $media = levelup_get_thumb_img( $thumb_args ); $classes = array('post'); $classes_div = array(); $classes_div[] = 'isotope-item'; $classes_div[] = 'grid-item'; if ($config->get('items_animation')) { $classes_div[] = 'do-animation'; } if ( $use_ext_link ) { $classes[] = 'with-link'; } 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'; } } } else { $classes_div[] = levelup_calc_columns_class($config->get('columns'), ($config->get('columns_fixed') ? true : false)); } $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'; } $background_image = isset($thumb_meta) ? 'background-image:url(' . esc_url($thumb_meta[0]) . ');' : ''; $title_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('title_font_color')) { $title_style .= 'color: ' . esc_attr( $config->get('title_font_color') ) . ';'; } } if ($config->get('caption_align')) { $title_style .= 'text-align: ' . esc_attr( $config->get('caption_align') ) . ';'; } ?> <div class="<?php echo levelup_sanitize_classes( $classes_div ); ?>"> <article <?php post_class( levelup_sanitize_classes( $classes ) ); ?><?php if ($config->get('scroll_animation')):?> data-animated="1" data-count="<?php echo esc_attr( $item_count );?>"<?php echo $animation_data;?><?php endif;?>> <div class="grid"> <figure> <div class="picture"> <?php if ($config->get('type') == 'grid_adv'): ?> <div class="item-content img" style="<?php echo $background_image;?>"></div> <?php echo $overlay_div;?> <?php else: ?> <?php if ( $media ) { echo $media ; } ?> <?php endif; ?> <?php if ($config->get('hover_element') == 'cross'): ?><div class="hover-element<?php echo ' element-color-' . esc_attr( $config->get('hover_element_color') ); ?>"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new -50 -50 50 50" xml:space="preserve"> <rect x="50" y="0" fill="#FFFFFF" width="1" height="30"/> <rect x="70.0" y="50.0" fill="#FFFFFF" width="30" height="1"/> <rect x="50.0" y="70.0" fill="#FFFFFF" width="1" height="30"/> <rect x="0.0" y="50.0" fill="#FFFFFF" width="30" height="1"/> </svg> </div><?php endif; ?> </div> <?php if ($config->get('show_caption')) : $attachment_title = get_the_excerpt( $thumb_id ); if(!empty($attachment_title)): ?> <div class="figcaption"<?php if ($config->get('title_bottom')){ echo ' style="padding:0;bottom:' . esc_attr( $config->get('title_bottom') ) . '%"'; }?>> <h2<?php echo ($title_style ? ' style="' . esc_attr( $title_style ) . '"' : ''); ?>><?php ; echo $attachment_title; ?></h2> </div> <?php endif;?> <?php endif;?> <?php if ( $link_href2 ) { ?><a class="link <?php echo esc_attr( $link_class2 ); if ( ! $config->get( 'use_ext_link' ) ) { echo ' lightbox'; } ?>" href="<?php echo esc_url( $link_href2 );?>"<?php echo $image_title ? ' title="' . esc_attr($image_title) . '"' : ''; ?><?php echo $use_ext_link && $config->get('use_link_blank') ? 'target="_blank"' : ''; ?> ></a><?php } ?> </figure> </div> </article><!-- #post-<?php the_ID(); ?> --> </div>