function sf_portfolio_related() { global $post; $related = sf_portfolio_related_posts($post->ID); if ($related->have_posts()) { ?> <div class="container"> <div class="related-projects clearfix"> <h3 class="spb-heading"><span><?php _e("Related Projects", "swiftframework"); ?> </span></h3> <ul class="row"> <?php while ($related->have_posts()) { $related->the_post(); ?> <?php $item_title = get_the_title(); $thumb_image = ""; $thumb_image = sf_get_post_meta($post->ID, 'sf_thumbnail_image', true); if ($thumb_image == "") { $thumb_image = get_post_thumbnail_id($post->ID); } $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); if ($thumb_img_url == "") { $thumb_img_url = "default"; } $image = sf_aq_resize($thumb_img_url, 300, 225, true, false); ?> <li class="col-sm-3"> <figure class="animated-overlay"> <img src="<?php echo $image[0]; ?> " width="<?php echo $image[1]; ?> " height="<?php echo $image[2]; ?> " alt="<?php echo $item_title; ?> " /> <a href="<?php the_permalink(); ?> "></a> <figcaption> <div class="thumb-info"> <h4><?php echo $item_title; ?> </h4> <i class="ss-navigateright"></i> </div> </figcaption> </figure> </li> <?php } ?> </ul> </div> </div> <?php } ?> <?php }
function sf_portfolio_related_projects() { global $post, $sf_options; $fullwidth = $sf_options['related_projects_fullwidth']; $item_count = $sf_options['related_projects_columns']; $related = sf_portfolio_related_posts($post->ID, $item_count); $item_class = "col-sm-4"; $wrap_class = $heading_class = ""; if ($fullwidth) { $heading_class = "container"; } else { $wrap_class = "container"; } $hover_style = "default"; // Thumb Type if ($hover_style == "default" && function_exists('sf_get_thumb_type')) { $wrap_class .= ' ' . sf_get_thumb_type(); } else { $wrap_class .= ' thumbnail-' . $hover_style; } if ($item_count == "4") { $item_class = "col-sm-3"; } if ($related->have_posts()) { ?> <section class="related-projects <?php echo esc_attr($wrap_class); ?> clearfix"> <h2 class="<?php echo esc_attr($heading_class); ?> "><?php apply_filters('sf_related_projects_heading', _e("Related Projects", "swiftframework")); ?> </h2> <div class="clearfix"> <?php while ($related->have_posts()) { $related->the_post(); ?> <?php $item_title = get_the_title(); $item_subtitle = sf_get_post_meta($post->ID, 'sf_portfolio_subtitle', true); $thumb_image = $port_hover_style = $port_hover_text_style = ""; $thumb_image = sf_get_post_meta($post->ID, 'sf_thumbnail_image', true); if (!$thumb_image) { $thumb_image = get_post_thumbnail_id(); } $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); if ($thumb_img_url == "") { $thumb_img_url = "default"; } $image = sf_aq_resize($thumb_img_url, 500, 375, true, false); $image_alt = esc_attr(sf_get_post_meta($thumb_image, '_wp_attachment_image_alt', true)); $port_hover_bg_color = sf_get_post_meta($post->ID, 'sf_port_hover_bg_color', true); $port_hover_text_color = sf_get_post_meta($post->ID, 'sf_port_hover_text_color', true); if ($port_hover_bg_color != "") { $overlay_opacity = $sf_options['overlay_opacity']; if ($overlay_opacity == 100) { $overlay_opacity = '1'; } else { $overlay_opacity = '0.' . $overlay_opacity; } $port_hover_bg_rgb = sf_hex2rgb($port_hover_bg_color); $port_hover_style = 'style="background-color:rgba(' . $port_hover_bg_rgb['red'] . ',' . $port_hover_bg_rgb['green'] . ',' . $port_hover_bg_rgb['blue'] . ',' . $overlay_opacity . ')"'; } if ($port_hover_text_color != "") { $port_hover_text_style = 'style="color: ' . $port_hover_text_color . ';"'; } ?> <article class="<?php echo esc_attr($item_class); ?> "> <figure class="animated-overlay overlay-style"> <img src="<?php echo esc_url($image[0]); ?> " width="<?php echo esc_attr($image[1]); ?> " height="<?php echo esc_attr($image[2]); ?> " alt="<?php echo esc_attr($image_alt); ?> "/> <a href="<?php the_permalink(); ?> "></a> <figcaption <?php echo esc_attr($port_hover_style); ?> > <div class="thumb-info"> <h4 <?php echo esc_attr($port_hover_text_style); ?> ><?php echo esc_attr($item_title); ?> </h4> <div class="name-divide"></div> <h5 <?php echo esc_attr($port_hover_text_style); ?> ><?php echo esc_attr($item_subtitle); ?> </h5> </div> </figcaption> </figure> </article> <?php } ?> </div> </section> <?php } }
</section> <?php } } } ?> </div> <?php } ?> <?php $related = sf_portfolio_related_posts($post->ID); if ($related->have_posts()) { ?> <div class="container"> <div class="related-projects clearfix"> <h3 class="spb-heading"><span><?php _e("Related Projects", "swiftframework"); ?> </span></h3> <ul class="row"> <?php while ($related->have_posts()) {
function sf_portfolio_related_projects() { global $post, $sf_options; $fullwidth = $sf_options['related_projects_fullwidth']; $gutters = false; if (isset($sf_options['related_projects_gutters'])) { $gutters = $sf_options['related_projects_gutters']; } $item_count = $sf_options['related_projects_columns']; $related = sf_portfolio_related_posts($post->ID, $item_count); $item_class = "col-sm-4"; $wrap_class = $heading_class = ""; if ($fullwidth) { $heading_class = "container"; } else { $wrap_class = "container"; } $hover_style = "default"; if ($gutters) { $wrap_class .= " gutters"; } else { $wrap_class .= " no-gutters"; } // Thumb Type if (function_exists('sf_get_thumb_type') && sf_theme_opts_name() == "sf_atelier_options") { $wrap_class .= ' ' . sf_get_thumb_type(); } else { if (function_exists('sf_get_thumb_type') && $hover_style == "default") { $wrap_class .= ' ' . sf_get_thumb_type(); } else { $wrap_class .= ' thumbnail-' . $hover_style; } } if ($item_count == "4") { $item_class = "col-sm-3"; } if (sf_theme_supports('alt-gallery-hover')) { $item_class .= " portfolio-item gallery-item"; } if ($related->have_posts()) { ?> <section class="related-projects <?php echo esc_attr($wrap_class); ?> clearfix"> <h2 class="<?php echo esc_attr($heading_class); ?> "><?php echo apply_filters('sf_related_projects_heading', __("Related Projects", "swiftframework")); ?> </h2> <div class="row clearfix"> <?php while ($related->have_posts()) { $related->the_post(); ?> <?php $item_title = get_the_title(); $item_subtitle = sf_get_post_meta($post->ID, 'sf_portfolio_subtitle', true); $thumb_image = $port_hover_style = $port_hover_text_style = ""; $thumb_image = sf_get_post_meta($post->ID, 'sf_thumbnail_image', true); if (!$thumb_image) { $thumb_image = get_post_thumbnail_id(); } $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); if ($thumb_img_url == "") { $thumb_img_url = "default"; } $image = sf_aq_resize($thumb_img_url, 500, 375, true, false); $image_alt = esc_attr(sf_get_post_meta($thumb_image, '_wp_attachment_image_alt', true)); $port_hover_bg_color = sf_get_post_meta($post->ID, 'sf_port_hover_bg_color', true); $port_hover_text_color = sf_get_post_meta($post->ID, 'sf_port_hover_text_color', true); if ($port_hover_bg_color != "") { if (isset($sf_options['overlay_opacity'])) { $overlay_opacity = $sf_options['overlay_opacity']; if ($overlay_opacity == 100) { $overlay_opacity = '1'; } else { $overlay_opacity = '0.' . $overlay_opacity; } $port_hover_bg_rgb = sf_hex2rgb($port_hover_bg_color); $port_hover_style = 'style="background-color:rgba(' . $port_hover_bg_rgb['red'] . ',' . $port_hover_bg_rgb['green'] . ',' . $port_hover_bg_rgb['blue'] . ',' . $overlay_opacity . ');"'; } else { if (isset($sf_options['overlay_opacity_top'])) { $overlay_opacity_top = $sf_options['overlay_opacity_top']; $overlay_opacity_bottom = $sf_options['overlay_opacity_bottom']; $port_hover_bg_rgb = sf_hex2rgb($port_hover_bg_color); if ($overlay_opacity_top < 100 || $overlay_opacity_bottom < 100) { $overlay_opacity_top = $overlay_opacity_top < 100 ? '0.' . $overlay_opacity_top : '1.0'; $overlay_opacity_bottom = $overlay_opacity_bottom < 100 ? '0.' . $overlay_opacity_bottom : '1.0'; $port_hover_style = 'style="background: -webkit-gradient(linear,left top,left bottom,color-stop(25%,rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_top . ')),to(rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_bottom . '))); background: -webkit-linear-gradient(top, rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_top . ') 25%,rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_bottom . ') 100%); background: linear-gradient(to bottom, rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_top . ') 25%, rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_bottom . ') 100%);"'; } } } } if ($port_hover_text_color != "") { $port_hover_text_style = 'style="color: ' . $port_hover_text_color . ';"'; } ?> <article class="<?php echo esc_attr($item_class); ?> "> <figure class="animated-overlay overlay-style"> <img src="<?php echo esc_url($image[0]); ?> " width="<?php echo esc_attr($image[1]); ?> " height="<?php echo esc_attr($image[2]); ?> " alt="<?php echo esc_attr($image_alt); ?> "/> <a href="<?php the_permalink(); ?> "></a> <figcaption <?php echo esc_attr($port_hover_style); ?> > <div class="thumb-info"> <h4 <?php echo esc_attr($port_hover_text_style); ?> ><?php echo esc_attr($item_title); ?> </h4> <div class="name-divide"></div> <h5 <?php echo esc_attr($port_hover_text_style); ?> ><?php echo esc_attr($item_subtitle); ?> </h5> </div> </figcaption> </figure> </article> <?php } ?> </div> </section> <?php } }