function _xt_widget_blog_daogou($layout) { echo '<ul class="media-list">'; if (have_posts()) { global $post; while (have_posts()) { the_post(); ?> <li class="media"> <?php if (has_post_thumbnail()) { echo '<a class="pull-left" href="' . get_permalink() . '" target="_blank">' . get_the_post_thumbnail(null, 'xt-daogou-post-thumbnail') . '</a>'; } else { echo '<a class="pull-left" href="' . get_permalink() . '" target="_blank"><img class="media-object" data-src="holder.js/180x180/text:无图无真相"></a>'; } ?> <div class="media-body"> <h4 class="media-heading"><a href="<?php the_permalink(); ?> " target="_blank"><?php the_title(); ?> </a></h4> <div class="media"> <?php echo wp_trim_words(strip_tags(get_the_content()), $layout == 'span12' ? 280 : 150); ?> <a href="<?php the_permalink(); ?> " target="_blank" rel="nofollow">阅读全文</a> </div> </div> <div class="pull-right"> <ul class="thumbnails"> <?php $items = get_post_meta($post->ID, 'xt_items', true); if (!empty($items)) { foreach ($items as $item) { if (!empty($item['pic'])) { ?> <li><a class="thumbnail" href="<?php echo xt_jump_url(array('id' => get_the_share_key($item['key']), 'type' => $item['type'], 'share' => $item['guid'])); ?> " target="_blank"> <img src="<?php echo xt_pic_url($item['pic'], 160, $item['type']); ?> "></a></li> <?php } } } ?> </ul> </div> </li> <?php } } echo '</ul>'; }
</div> </div> </div> </div> <?php } elseif ($item['from_type'] == 'paipai') { ?> <div class="row-fluid"> <div class="span12"> <div class="pull-left" style="width:300px;overflow:hidden"> <a href="<?php echo $clickUrl; ?> " target="_blank"> <img src="<?php echo xt_pic_url($item['pic_url'], 300, $item['from_type']); ?> "/> </a> </div> <div class="pull-left" style="margin-left: 20px;width:380px;overflow: hidden;"> <h4 style="margin-top:0px;"><a id="X_Item-Get-Title" href="<?php echo $clickUrl; ?> " target="_blank"><?php echo $item['title']; ?> </a></h4> <table class="table"> <tbody> <?php
/** * Retrieve the picture url of the current item in the Xintaoke Loop. * * @uses $share * * @return int */ function get_the_share_picurl($size = 200, $_share = 0) { if (!$_share) { global $share; $_share = $share; } return apply_filters('the_share_picurl', xt_pic_url($_share->pic_url, $size, $_share->from_type)); }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); echo $before_widget; global $post; if (have_posts()) { while (have_posts()) { the_post(); echo '<div class="hd"><h4 class="xt-bd-l"><span><a href="' . get_permalink() . '">' . get_the_title() . '</a> <small>' . get_the_date() . '</small></span></h4></div><div class="bd">'; echo '<div class="row-fluid">'; the_content(); $items = get_post_meta($post->ID, 'xt_items', true); if (!empty($items)) { $itemsHtml = ''; foreach ($items as $item) { if (!empty($item['pic'])) { $_url = xt_jump_url(array('id' => get_the_share_key($item['key']), 'type' => $item['type'], 'share' => $item['guid'])); $itemsHtml .= '<li> <a class="thumbnail" rel="nofollow" target="_blank" href="' . $_url . '" title="' . $item['title'] . '">' . xt_write_pic(base64_encode(xt_pic_url($item['pic'], 160, $item['type'])), $item['title'], 0, 0, '', '', false) . '</a> <div class="caption"> <div class="desc"><a rel="nofollow" target="_blank" href="' . $_url . '" class="permalink">' . $item['title'] . '</a></div> </div> </li>'; } } if (!empty($itemsHtml)) { echo '<div class="span12"><h4>推荐的宝贝</h4><ul class="thumbnails">' . $itemsHtml . '</ul></div>'; } } comments_template('xt-daogou_comments.php', true); echo '</div></div>'; } } echo $after_widget; }
function convert_album_picurls_small($pic_urls = array()) { $result = array(); if (count($pic_urls) > 0) { $count = 0; foreach ($pic_urls as $_p) { $__p = ''; $size = 80; $__p = xt_pic_url($_p, $size); if (!empty($__p)) { $result[] = $__p; } $count++; } } $_count = count($result); if ($_count < 9) { for ($i = 0; $i < 9 - $_count; $i++) { $result[] = ''; } } return $result; }