function getSliderPromotions($promotions) { $options = get_option('site_basic_options'); ?> <?php $args = array('post__in' => explode(",", $promotions), 'post_type' => 'promotion'); ?> <?php $promotion_query = new WP_Query($args); ?> <?php if ($promotion_query->have_posts()) { while ($promotion_query->have_posts()) { $promotion_query->the_post(); ?> <?php $postid = get_the_ID(); ?> <?php $thumb = get_the_post_thumbnail($postid, 'promotion'); $pattern = "/(?<=src=['|\"])[^'|\"]*?(?=['|\"])/i"; preg_match($pattern, $thumb, $thePath); $theSrc = get_timthumb_src($thePath[0]); ?> <li class="promotion"> <div class="promotion-text"> <h3><?php the_title(); ?> </h3> <div class="promotion-meta"> <?php $postid = get_the_ID(); ?> <?php $custom = get_post_custom($postid); $saving = $custom["saving"][0]; $external_link = $custom["link"][0]; $link_type = $custom["link_type"][0]; $start_date = $custom["start_date"][0]; $end_date = $custom["end_date"][0]; $promotion_link = $custom["promotion_link"][0]; $promotion_link_category = $custom["promotion_link_category"][0]; echo strlen($link_type); if ($link_type == "category") { $link = $promotion_link_category; } elseif ($link_type == "product") { $link = $promotion_link; } elseif ($link_type == "external") { $link = $external_link; } else { $link = "#"; } ?> <span class="saving"><?php echo $saving; ?> </span> <span class="promotion_link"><?php echo $link; ?> </span> <span class="start-date"><?php echo $start_date; ?> </span> <span class="end-date"><?php echo $end_date; ?> </span> </div> <div class="promotion-content"> <?php the_content(__('Read more', 'flexishop')); ?> </div> </div> <div class="promotion-header"> <a href="<?php echo $link; ?> " <?php if ($custom['pretty_photo'][0] == 'yes' && $link_type == 'external') { ?> rel="prettyPhoto"<?php } ?> title="<?php the_title(); ?> "><?php if ($options['themelayout'] == 'boxed') { ?> <img src="<?php bloginfo('template_url'); ?> /timthumb.php?src=<?php echo $theSrc; ?> &w=896" alt=""><?php } else { the_post_thumbnail('promotion'); } ?> </a> </div> </li> <?php } } }
/** * Muestra la url de primera imagen del post (la imagen destacada por defecto) * @param array $params */ function the_timthumb_src($params = array()) { echo get_timthumb_src($params); }
$image = " yes-image"; } if ($i == 4) { $rightCol = " col-right"; } echo "<li class='latest-product" . $image . $rightCol . "'>"; if ($latest_product['price'] - $latest_product['special_price'] > 0 && $latest_product['special_price'] > 0) { ?> <span class="sale-icon"><?php _e('Sale!', 'flexishop'); ?> </span><?php } ?> <?php echo "<div class='padding'>"; if ($latest_product['image']) { $theSrc = get_timthumb_src(WPSC_THUMBNAIL_URL . $latest_product['image']); if ($options['themelayout'] == 'boxed') { $output = "<img src='" . get_bloginfo('template_url') . "/timthumb.php?src=" . $theSrc . "&w=174&q=100' title='" . $latest_product['name'] . "' alt='" . $latest_product['name'] . "' />"; } else { $output = "<img src='" . get_bloginfo('template_url') . "/timthumb.php?src=" . $theSrc . "&w=186&q=100' title='" . $latest_product['name'] . "' alt='" . $latest_product['name'] . "' />"; } } else { $output = __("No Image Available", 'flexishop'); } echo '<div class="imagecol"><a href="' . wpsc_product_url($latest_product['id']) . '">' . $output . '</a></div>'; echo "<div class='producttext'><h3><a href='" . wpsc_product_url($latest_product['id']) . "'>" . stripslashes(${$latest_product}['name']) . "</a></h3></div>"; echo "</div></li>"; } echo "</ul>";