Ejemplo n.º 1
0
# 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
$image_output = get_resized_image_output(array("image_url" => trim($image), "image_id" => "", "w" => $w, "h" => $h, "crop" => $crop));
if (!empty($image_output)) {
    ?>
Ejemplo n.º 2
0
    /**
     * Display the new Custom Fields meta box
     */
    function displayCustomFields()
    {
        global $post;
        ?>
			 <div class="box right-col metaboxes side">
				<?php 
        wp_nonce_field($this->settings['slug'], $this->settings['slug'] . '_wpnonce', false, true);
        // Check capability
        if (!current_user_can($this->settings['capability'], $post->ID)) {
            $output = false;
        } else {
            $output = true;
        }
        // Output if allowed
        if ($output) {
            ?>
  
		
							<?php 
            //get stored values
            $rt_gallery_images = get_post_meta($post->ID, $this->prefix . "rt_gallery_images", true);
            //to compatible with earlier rt-framework implode the images into an array first
            if (is_array($rt_gallery_images) && !empty($rt_gallery_images)) {
                $rt_gallery_images = implode(",", $rt_gallery_images);
            }
            ?>

							<ul class="rt-gallery-uploaded-photos">
							 

									<?php 
            if (!empty($rt_gallery_images)) {
                //make an array from the image list
                $rt_gallery_images_array = explode(",", $rt_gallery_images);
                for ($i = 0; $i < count($rt_gallery_images_array); $i++) {
                    //the image url
                    $image_url = rt_find_image_org_path(trim($rt_gallery_images_array[$i]));
                    //find the id of image
                    $image_id = rt_get_attachment_id_from_src(rt_clean_thumbnail_ext($image_url));
                    //the thumbmail url
                    $thumbnail = wp_get_attachment_image_src($image_id, "thumbnail", true, "");
                    if (strpos($thumbnail[0], "default.png")) {
                        $thumbnail[0] = $image_url;
                    }
                    echo ' <li><img src="' . $thumbnail[0] . '" data-rel="' . $image_url . '"></li> ';
                }
            }
            ?>

							</ul> 

							<input type="hidden" name="<?php 
            echo $this->prefix;
            ?>
rt_gallery_images" value="<?php 
            echo $rt_gallery_images;
            ?>
" id="rt-gallery-images" class="upload_field">

							<div class="rt-gallery-new-photos-holder">
								<div class="rt-gallery-new-photos"></div>
							</div>
					<?php 
        }
        ?>
 
					
					<div class="rt_gallery_add_button icon-plus-squared-1 button"><?php 
        echo __("Add New Images", "rt_theme_admin");
        ?>
</div> 	 
			</div>
			<?php 
    }
Ejemplo n.º 3
0
    function rt_shortcode_slider_slides($atts, $content = null)
    {
        //[slide link="link" title="title" img_url="" video_url="" styling="" title_color="" title_bg_color="" text_color="" text_bg_color="" title_size="" text_size=""]slide_text[/slide]
        global $rt_slider_width, $rt_slider_height, $rt_slider_script, $rt_total_slide, $rt_slide_count, $rt_caption_output, $rt_slide_output, $rt_slider_id, $rt_image_resize, $rt_image_crop;
        $text = $image_output = $resized_img_url = "";
        $rt_slide_count++;
        //defaults
        extract(shortcode_atts(array("link" => '', "title" => '', "title2" => '', "img_url" => '', "video_url" => '', "text_align" => 'left', "stretch_images" => true, "styling" => "", "title_color" => "", "title_bg_color" => "", "text_color" => "", "text_bg_color" => "", "title_size" => "", "text_size" => ""), $atts));
        //nivo slide id
        $nivo_slide_id = $rt_slider_script == "nivo_slider" ? "random_" . rand(100000, 1000000) : "";
        //randomized
        $nivo_image_sync_id = $nivo_slide_id ? "#" . $nivo_slide_id : "";
        //caption css
        $caption_css = "";
        if ($styling == "new") {
            $caption_css .= !empty($title_color) ? " color:" . rt_rgba2hex($title_color) . "; color:" . $title_color . ";" : "";
            $caption_css .= !empty($title_bg_color) ? "background-image:none; background-color:" . rt_rgba2hex($title_bg_color) . "; background-color:" . $title_bg_color . ";" : "background-color:transparent;padding-top:0;padding-bottom:0;";
            $caption_css .= !empty($title_size) ? " font-size:" . str_replace("px", "", $title_size) . "px;line-height:140%;" : "";
            $caption_css = !empty($caption_css) ? 'style="' . $caption_css . '"' : "";
        }
        //text css
        $text_css = "";
        if ($styling == "new") {
            $text_css .= !empty($text_color) ? " color:" . rt_rgba2hex($text_color) . "; color:" . $text_color . ";" : "";
            $text_css .= !empty($text_bg_color) ? "background-image:none; background-color:" . rt_rgba2hex($text_bg_color) . "; background-color:" . $text_bg_color . ";" : "background-color:transparent;padding-top:0;padding-bottom:0;";
            $text_css .= !empty($text_size) ? " font-size:" . str_replace("px", "", $text_size) . "px;line-height:140%;" : "";
            $text_css = !empty($text_css) ? 'style="' . $text_css . '"' : "";
        }
        //allowed html codes
        $allowed_html_title = array('br' => array());
        $allowed_html_text = array('a' => array('href' => array(), 'title' => array()), 'br' => array(), 'em' => array(), 'strong' => array());
        //title
        $title = !empty($title) ? !empty($link) ? '<div class="caption-one" ' . $caption_css . '><a href="' . $link . '" title="' . wp_kses($title, "") . '" ' . $caption_css . '>' . wp_kses(stripcslashes($title), $allowed_html_title) . '</a></div>' . "\n" : '<div class="caption-one" ' . $caption_css . '>' . wp_kses($title, $allowed_html_title) . '</div>' . "\n" : "";
        //text
        $text = !empty($content) ? '<div class="caption-text" ' . $text_css . '>' . trim(wp_kses(stripcslashes($content), $allowed_html_text)) . '</div>' . "\n" : "";
        //li class
        $li_class = $stretch_images == "true" ? "stretch" : "";
        //featured image output
        if (!empty($img_url)) {
            $img_url = rt_find_image_org_path($img_url);
            $image_id = rt_get_attachment_id_from_src($img_url);
            $image_alternative_text = get_post_meta($image_id, '_wp_attachment_image_alt', true);
            $image_meta_data = wp_get_attachment_metadata($image_id, "true");
            $image_height = isset($image_meta_data["height"]) ? $image_meta_data["height"] : "";
            //crop & resize = true
            if (!empty($rt_image_resize) && !empty($rt_image_crop)) {
                $resized_img_url = rt_vt_resize($image_id, $img_url, $rt_slider_width, $rt_slider_height, true, false);
            }
            //crop = true & resize = false
            if (empty($rt_image_resize) && !empty($rt_image_crop)) {
                $resized_img_url = rt_vt_resize($image_id, $img_url, $rt_slider_width, $rt_slider_height, false, true);
            }
            //crop = false & resize = true
            if (!empty($rt_image_resize) && empty($rt_image_crop)) {
                $resized_img_url = rt_vt_resize($image_id, $img_url, $rt_slider_width, $rt_slider_height, false, false);
            }
            //if resized or cropped
            if (isset($resized_img_url) && is_array($resized_img_url)) {
                $img_url = $resized_img_url["url"];
                $image_height = $resized_img_url["height"];
            }
            //first image height
            $rt_first_slide_height = $rt_slide_count == 1 && $image_height ? $image_height : 0;
            $rt_first_slide_data = $rt_slide_count == 1 ? 'data-flexfirstslide="true"' : "";
            $rt_first_slide_height_data = isset($rt_first_slide_height) && $rt_first_slide_height > 0 ? 'data-sliderminheight="' . $rt_first_slide_height . 'px"' : "";
            $image_output = !empty($link) ? sprintf('<a href="%s"><img src="%s" alt="%s" title="%s" /></a>' . "\n", $link, $img_url, $image_alternative_text, $nivo_image_sync_id) : sprintf('<img src="%s" alt="%s" title="%s" />' . "\n", $img_url, $image_alternative_text, $nivo_image_sync_id);
        }
        //output for flexslider
        if ($rt_slider_script == "flex_slider") {
            //caption
            $rt_caption_output = !empty($title) || !empty($text) ? sprintf('<div class="flex-caption %s"><div class="caption-holder">%s %s %s</div></div>' . "\n", $text_align, $title, $title2, $text) : "";
            //slide output
            $rt_slide_output = sprintf('<li class="%s" %s %s><div class="slide_data">%s %s</div></li>' . "\n", $li_class, $rt_first_slide_height_data, $rt_first_slide_data, $image_output, $rt_caption_output);
            return $rt_slide_output;
        }
        //output for nivoslider
        if ($rt_slider_script == "nivo_slider") {
            //caption
            $rt_caption_output .= !empty($title) || !empty($text) ? sprintf('
			<div id="%s" class="nivo-html-caption">			
				<div class="nivo-title caption-%s">
				%s
				</div>
				<div class="nivo-text">
				%s
				</div>
			</div>
			' . "\n", $nivo_slide_id, $rt_slide_count, $title, $text) : "";
            //slide output
            $rt_slide_output .= sprintf("%s", $image_output);
            if ($rt_total_slide == $rt_slide_count) {
                //the slider holder output
                $rt_slide_output = sprintf('

				<div class="nivo-container theme-default">
					<div class="nivoSlider" id="%s">
						%s
					</div>
						%s
				</div>

			', $rt_slider_id, $rt_slide_output, $rt_caption_output);
                return $rt_slide_output;
            }
        }
    }