# # rt-theme # loop item for product custom posts # global $rt_item_width, $rt_sidebar_location, $rt_display_descriptions, $rt_display_price, $rt_display_titles; //taxonomy expeptions if (is_tax()) { //$rt_display_descriptions = $rt_display_titles = true; $rt_display_price = get_option(RT_THEMESLUG . "_show_price_in_list"); } // featured 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 $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
/** * Get post values for single product pages * gets data of a product item including metas * * @param array $post * @param array $atts * @return array */ function rt_get_product_single_post_values($post = array(), $atts = array()) { //defaults $atts = shortcode_atts(apply_filters("single_products_layout", array("gallery_images_max_height" => 1000, "gallery_images_crop" => "false", "share_buttons" => "true", "display_price" => get_theme_mod(RT_THEMESLUG . "_show_price_in_pages"))), $atts); extract($atts); //single content layout $single_content_layout = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_product_content_layout_options', true); $content_width = $single_content_layout == "new" ? get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_product_content_width', true) : get_theme_mod(RT_THEMESLUG . "_product_content_width"); $content_style = $single_content_layout == "new" ? get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_product_content_style', true) : get_theme_mod(RT_THEMESLUG . "_product_content_style"); $content_width = !empty($content_width) ? $content_width : "1/1"; $content_style = !empty($content_style) ? $content_style : "1"; // 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 $rt_gallery_images = rt_merge_featured_images($rt_gallery_images); //add the wp featured image to the array //calculate tabs content width $slider_width = explode("/", $content_width); $slider_width = $slider_width[1] - $slider_width[0] . "/" . $slider_width[1]; //related products $related_products = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'related_products[]', true); //attached documents $attached_documents = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'attached_documents', true); //is tabs required $tabbed_page = false; //free tabs $tab_count = 4; for ($i = 0; $i < $tab_count + 1; $i++) { if (trim(get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'free_tab_' . $i . '_title', true))) { $tabbed_page = true; } } $tabbed_page = !empty($related_products) || !empty($attached_documents) ? true : $tabbed_page; //create global values array $rt_get_product_single_post_values = array("title" => get_the_title(), "permalink" => get_permalink(), "content" => get_the_content(), "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), "sku" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'sku', true), "attached_documents" => $attached_documents, "related_products" => $related_products, "short_desc" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'short_description', true), "tabbed_page" => $tabbed_page, "gallery_images" => $rt_gallery_images, "tab_count" => $tab_count, "slider_width" => $slider_width, "content_width" => $content_width, "content_style" => $content_style); $rt_get_product_single_post_values = array_merge($rt_get_product_single_post_values, $atts); return $rt_get_product_single_post_values; }