/** * Image Gallery - Single Image Shortcode * * @param array $atts * @param string $content * @return html */ function rt_gal_item($atts, $content = null) { global $rt_image_gallery_globals, $rt_global_variables; //defaults extract(shortcode_atts(array("id" => '', "class" => '', "image_id" => '', "image_url" => '', "custom_link" => '', "title" => '', "action" => 'lightbox', "link_target" => '_self'), $atts)); //variables $output = $caption_output = $lightbox_link = $image_effect = ""; // Thumbnail width & height $w = rt_get_min_resize_size($rt_image_gallery_globals["list_layout"]); $h = $rt_image_gallery_globals["crop"] == "true" ? $w : 10000; // Get image data $image_args = array("image_url" => $image_url, "image_id" => $image_id, "w" => $w, "h" => $h, "crop" => $rt_image_gallery_globals["crop"]); $image_output = rt_get_image_data($image_args); //tooltip $tooltip = $rt_image_gallery_globals["tooltips"] == "true" ? ' data-placement="top" data-toggle="tooltip" data-original-title="' . $title . '"' : ""; //create lightbox link if ($action == "lightbox") { $image = rt_create_lightbox_link(array('class' => 'zoom lightbox_ imgeffect', 'href' => $image_output["image_url"], 'title' => $title, 'data_group' => $rt_image_gallery_globals["gallery_id"], 'data_title' => $title, 'data_description' => "", 'tooltip' => $rt_image_gallery_globals["tooltips"], 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'inner_content' => '<img src="' . $image_output["thumbnail_url"] . '" alt="' . $title . '" class="img-responsive">', 'echo' => false)); } elseif ($action == "custom_link") { $image = sprintf(' <a href="%1$s" title="%2$s" target="%3$s" class="link icon imgeffect"> <img src="%4$s" class="img-responsive" alt="%2$s"%5$s> </a>', $custom_link, $title, $link_target, $image_output["thumbnail_url"], $tooltip); } else { $image = sprintf('<img src="%s" class="img-responsive" alt="%s"%s> ', $image_output["thumbnail_url"], $title, $tooltip); } //create caption $caption_output = !empty($content) ? '<div class="caption">' . rt_visual_composer_content_fix($content, "true") . '</div>' : ""; //open holder if ($rt_image_gallery_globals["counter"] % $rt_image_gallery_globals["column_count"] == 1 || $rt_image_gallery_globals["column_count"] == 1) { $output .= '<div class="row fixed_heights">'; } //id attr $id_attr = !empty($id) ? 'id="' . $id . '"' : ""; //list items output $output .= sprintf(' <div %1$s class="col %3$s col-xs-12 %2$s"> %4$s %5$s </div> ', $id_attr, $class, rt_column_class($rt_image_gallery_globals["list_layout"]), $image, $caption_output); //close holder if ($rt_image_gallery_globals["counter"] % $rt_image_gallery_globals["column_count"] == 0 || $rt_image_gallery_globals["item_count"] == $rt_image_gallery_globals["counter"]) { $output .= '</div>'; } //increase counter $rt_image_gallery_globals["counter"]++; return $output; }
//turn into an array $rt_gallery_images = rt_merge_featured_images($rt_gallery_images); //add the wp featured image to the array // Values $image = is_array($rt_gallery_images) && isset($rt_gallery_images[0]) ? rt_find_image_org_path($rt_gallery_images[0]) : ""; $title = get_the_title(); $permalink = get_permalink(); $short_desc = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'short_description', true); $regular_price = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'price_regular', true); $sale_price = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'sale_price', true); //is crop active $crop = get_option(RT_THEMESLUG . '_product_image_crop') ? "true" : ""; //image max height $h = $crop ? get_option(RT_THEMESLUG . '_product_image_height') : 10000; //Thumbnail dimensions $w = rt_get_min_resize_size($rt_item_width); // Resize Image $image_output = get_resized_image_output(array("image_url" => trim($image), "image_id" => "", "w" => $w, "h" => $h, "crop" => $crop)); if (!empty($image_output)) { ?> <!-- product image --> <div class="featured_image"> <a href="<?php echo $permalink; ?> " title="<?php echo $title; ?> " rel="bookmark" ><?php echo $image_output; ?>
function rt_get_global_post_values($post = false, $item_width = 1) { //is crop active - featured image $crop = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'blog_image_crop', true); //max width $w = rt_get_min_resize_size($item_width); //featured image displaying options $featured_image_usage = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_featured_image_usage', true); $featured_image_position = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'featured_image_position', true) ? get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'featured_image_position', true) : "center"; $featured_image_width = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'blog_image_width', true); $featured_image_width = !empty($featured_image_width) && $featured_image_width > 0 ? $featured_image_width : $w; $featured_image_height = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'blog_image_height', true); $featured_image_height = !empty($featured_image_height) && $featured_image_height > 0 ? $featured_image_height : ($crop ? $w / 2 : 10000); $slider_image_height = $crop ? get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'blog_image_height', true) : 10000; $featured_image_id = get_post_thumbnail_id(); $featured_image_url = !empty($featured_image_id) ? wp_get_attachment_image_src($featured_image_id, "full") : ""; $featured_image_url = is_array($featured_image_url) ? $featured_image_url[0] : ""; //gallery usage $gallery_usage = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_gallery_usage', true); $gallery_usage_listing = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_gallery_usage_listing', true); //slider image dimensions $slider_image_crop = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'gallery_images_crop', true); $slider_image_width = $w; $slider_image_height = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'gallery_images_height', true) < 0 ? $slider_image_crop ? $w / 1.8 : 100000 : get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'gallery_images_height', true); // gallery images $rt_gallery_images = get_post_meta($post->ID, RT_COMMON_THEMESLUG . "rt_gallery_images", true); $rt_gallery_images = !empty($rt_gallery_images) ? !is_array($rt_gallery_images) ? explode(",", $rt_gallery_images) : $rt_gallery_images : array(); //turn into an array //create global values array $rt_global_post_values = array("title" => get_the_title(), "permalink" => get_permalink(), "featured_image_id" => $featured_image_id, "featured_image_url" => $featured_image_url, "max_image_width" => $w, "crop" => $crop, "show_author" => get_option(RT_THEMESLUG . '_show_small_dates'), "show_categories" => get_option(RT_THEMESLUG . '_show_categories'), "show_commnent_numbers" => get_option(RT_THEMESLUG . '_show_commnent_numbers'), "show_small_dates" => get_option(RT_THEMESLUG . '_show_small_dates'), "video_mp4" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_post_video_m4v', true), "video_webm" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_post_video_webm', true), "video_usage_listing" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_video_usage_listing', true), "audio_mp3" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_post_audio_mp3', true), "audio_ogg" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_post_audio_oga', true), "audio_usage_listing" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_audio_usage_listing', true), "external_video" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'video_url', true), "gallery_images" => $rt_gallery_images, "featured_image_resize" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'blog_image_resize', true), "post_format_link" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'post_format_link', true), "featured_image_usage" => $featured_image_usage, "featured_image_same_single_page" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'featured_image_same_single_page', true), "featured_image_single_page" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'featured_image_single_page', true), "featured_image_position" => $featured_image_position, "featured_image_width" => $featured_image_width, "featured_image_height" => $featured_image_height, "slider_image_crop" => $slider_image_crop, "slider_image_width" => $slider_image_width, "slider_image_height" => $slider_image_height, "gallery_usage" => $gallery_usage, "gallery_usage_listing" => $gallery_usage_listing); return $rt_global_post_values; }
/** * Create a carousel from the provided images * * @since 1.0 * * @param array $rt_gallery_images * @param string $id * @return output html */ function rt_create_image_carousel($atts = array()) { //defaults extract(shortcode_atts(array("id" => 'carousel-' . rand(100000, 1000000), "crop" => false, "h" => 10000, "w" => 10000, "rt_gallery_images" => array(), "column_width" => "1/1", "carousel_atts" => array(), "echo" => true, "lightbox" => "true"), $atts)); //slider id $slider_id = "slider-" . $id; //crop $crop = $crop === "false" ? false : $crop; //image dimensions for product image slider $w = empty($w) ? rt_get_min_resize_size($column_width) : $w; //height if (empty($h)) { $h = $crop ? $w / 1.5 : 10000; } //create slides and thumbnails outputs $output = array(); foreach ($rt_gallery_images as $image) { // Resize Image $image_output = is_numeric($image) ? rt_get_image_data(array("image_id" => trim($image), "w" => $w, "h" => $h, "crop" => $crop)) : rt_get_image_data(array("image_url" => trim($image), "w" => $w, "h" => $h, "crop" => $crop)); if ($lightbox != "false") { //create lightbox link $output[] = rt_create_lightbox_link(array('class' => 'imgeffect zoom lightbox_', 'href' => $image_output["image_url"], 'title' => __('Enlarge Image', 'rt_theme'), 'data_group' => $slider_id, 'data_title' => $image_output["image_title"], 'data_description' => $image_output["image_caption"], 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'echo' => false, 'inner_content' => sprintf('<img src="%s" alt="%s" itemprop="image">', $image_output["thumbnail_url"], $image_output["image_alternative_text"]))); } else { $output[] = sprintf('<img src="%s" alt="%s" itemprop="image">', $image_output["thumbnail_url"], $image_output["image_alternative_text"]); } } //create slider if ($echo) { echo rt_create_carousel($output, $carousel_atts); } else { return rt_create_carousel($output, $carousel_atts); } }
<?php # # rt-theme # post content for standart post types in carousels # global $rt_item_width, $rt_crop, $rt_display_excerpts, $rt_column_layout, $rt_limit_chars; //max width $rt_item_width_for_resize = isset($rt_column_layout) && is_numeric($rt_column_layout) && $rt_column_layout > $rt_item_width ? $rt_column_layout : $rt_item_width; $w = rt_get_min_resize_size($rt_item_width_for_resize); //max height $h = $rt_crop ? $w / 2 : 10000; //featured_image_id $featured_image_id = get_post_thumbnail_id(); // Create thumbnail image $thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $w, "h" => $h, "crop" => $rt_crop)) : ""; //the holder class for featured iamge and date $holder_class = !empty($thumbnail_image_output) ? "featured-image" : "meta"; ?> <div class="<?php echo $holder_class; ?> "> <span class="date"><?php the_time(get_option(RT_THEMESLUG . "_date_format")); ?> </span> <?php
* */ ?> <?php if (is_singular('portfolio')) { ?> <?php //is crop active $rt_crop = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'image_crop', true); //image max height $h = $rt_crop ? get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'portfolio_max_image_height', true) : 10000; //Thumbnail dimensions $w = rt_get_min_resize_size(1); ?> <?php /* * * Single Image * */ if (is_array($rt_gallery_images) && count($rt_gallery_images) == 1) { // Get image data $image_output = rt_get_image_data(array("image_url" => $image, "w" => $w, "h" => $h, "crop" => $rt_crop)); } if (!empty($image_output["thumbnail_url"])) { ?>
function rt_photo_gallery_lines($atts, $content = null) { //[image] global $rt_counter, $rt_item_width, $rt_randomID; //defaults extract(shortcode_atts(array("lightbox" => 'true', "custom_link" => '', "title" => '', "caption" => '', "open_in_new_tab" => 'false', "crop" => 'true'), $atts)); //if w & h suplied li's are fluid $rt_item_width = empty($rt_item_width) ? 6 : $rt_item_width; //layout name values $layout_values = array('', 'one', 'two', 'three', 'four', 'five', 'fluid'); //variables $items_output = $caption_output = $lightbox_link = $image_effect = ""; $photo = trim($content); // crop $crop = $crop == "false" ? false : true; // Thumbnail width & height $w = rt_get_min_resize_size($rt_item_width); $h = $crop ? $w / 1.5 : 10000; // Get image data $image_args = array("image_url" => $photo, "image_id" => "", "w" => $w, "h" => $h, "crop" => true); $image_output = rt_get_image_data($image_args); //target $target = $open_in_new_tab == "false" ? "_self" : "_new"; //create lightbox link if ($lightbox != "false") { $lightbox_link = rt_create_lightbox_link(array('class' => 'icon-zoom-in lightbox_ single', 'href' => $image_output["image_url"], 'title' => __('Enlarge Image', 'rt_theme'), 'data_group' => $rt_randomID, 'data_title' => $title, 'data_description' => $caption, 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'echo' => false)); $image_effect = "imgeffect"; } elseif ($custom_link == "" && $lightbox == "false") { $lightbox_link = ""; $image_effect = ""; } else { $lightbox_link = sprintf(' <a href="%s" class="icon-link single" title="%s" target="%s"></a>', $custom_link, $title, $target); $image_effect = "imgeffect"; } //create caption $caption_output = !empty($caption) ? sprintf(' <p class="gallery-caption-text">%s</p> ', $caption) : ""; // get the column class name $add_class = $layout_values[$rt_item_width]; //add first last classes if ($rt_counter % $rt_item_width == 1 || $rt_item_width == 1) { $add_class .= " first"; } if ($rt_counter % $rt_item_width == 0) { $add_class .= " last"; } //list items output $items_output .= sprintf(' <li class="box %s" data-rt-animate="animate" data-rt-animation-type="fadeIn"> <div class="%s"> %s <img src="%s" alt="%s"> </div> %s </li> ', $add_class, $image_effect, $lightbox_link, $image_output["thumbnail_url"], $title, $caption_output); $rt_counter++; return $items_output; }
/** * Get post values for loops * gets all data of a portfolio item including metas * * @param array $post * @param array $atts [atts of rt_product_post_loop function] * @return array */ function rt_get_product_loop_post_values($post = array(), $atts = array()) { extract($atts); //featured image $featured_image_id = get_post_thumbnail_id(); $featured_image_url = !empty($featured_image_id) ? wp_get_attachment_image_src($featured_image_id, "full") : ""; $featured_image_url = is_array($featured_image_url) ? $featured_image_url[0] : ""; /* //custom thumbnail max height & crop settings for this post $this_featured_image_settings = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'_featured_image_settings', true); $featured_image_max_height = $this_featured_image_settings == "new" ? get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'_portfolio_image_height', true) : $featured_image_max_height; $featured_image_crop = $this_featured_image_settings == "new" ? get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'_portfolio_image_crop', true) : $featured_image_crop; */ if ($featured_image_resize !== "false") { // thumbnail min width $w = !empty($featured_image_max_width) ? $featured_image_max_width : rt_get_min_resize_size($list_layout); // thumbnail max height $h = !empty($featured_image_max_height) ? $featured_image_max_height : 10000; //thumbnail output $thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $w, "h" => $h, "crop" => $featured_image_crop)) : ""; } else { //thumbnail output $thumbnail_image_output = !empty($featured_image_id) ? rt_get_image_output(array("image_url" => "", "image_id" => $featured_image_id)) : ""; } //permalink $permalink = get_permalink(); //create global values array $rt_product_post_values = array("title" => get_the_title(), "permalink" => $permalink, "featured_image_id" => $featured_image_id, "featured_image_url" => $featured_image_url, "regular_price" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'price_regular', true), "sale_price" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'sale_price', true), "short_desc" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'short_description', true), "thumbnail_image_output" => $thumbnail_image_output); return $rt_product_post_values; }
# image post format # global $rt_item_width, $rt_sidebar_location; $short_data = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_short_data', true); $long_data = get_the_content(); $permalink = !empty($long_data) ? get_permalink() : ""; ?> <div class="half-background"> <?php if (has_post_thumbnail() && !post_password_required()) { ?> <div class="person_image"> <?php // Create thumbnail image $thumbnail_image_output = get_resized_image_output(array("image_url" => "", "image_id" => get_post_thumbnail_id(), "w" => rt_get_min_resize_size($rt_item_width), "h" => 100000, "crop" => "")); echo $thumbnail_image_output; ?> </div> <?php } ?> <div class="person_name"> <?php if ($permalink) { ?> <h4><a href="<?php echo $permalink; ?>
function rt_woocommerce_template_loop_product_thumbnail() { global $post, $woocommerce, $woo_product_layout, $rt_title, $product; $image = has_post_thumbnail($post->ID) ? get_post_thumbnail_id($post->ID) : ""; //is crop active $crop = get_option(RT_THEMESLUG . '_woo_product_image_crop') ? "true" : ""; //image max height $h = $crop ? get_option(RT_THEMESLUG . '_woo_product_image_height') : 10000; //Thumbnail dimensions $w = rt_get_min_resize_size($woo_product_layout); // Resize Image $image_output = get_resized_image_output(array("image_url" => "", "image_id" => $image, "w" => $w, "h" => $h, "crop" => $crop)); if (!empty($image_output)) { if (!get_option(RT_THEMESLUG . "_hide_embedded_cart_button")) { echo '<!-- product image --><div class="featured_image"><div class="imgeffect"> '; echo do_action("rt_woocommerce_template_loop_add_to_cart"); echo $image_output; echo '</div></div>'; } else { echo '<!-- product image --><div class="featured_image">'; echo '<a href="' . get_permalink() . '">' . $image_output . '</a>'; echo '</div>'; } } }