function widget($args, $instance) { extract($args); $title = apply_filters('xt_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); if (empty($title)) { $title = '精彩推荐'; } $count = intval($instance['count']); $smallCount = intval(isset($instance['smallCount']) ? $instance['smallCount'] : 3); global $xt, $xt_user; if (isset($xt->is_share) && $xt->is_share && !empty($xt_user)) { query_albums(array('page' => 1, 'album_per_page' => $count, 'user_id' => $xt_user->ID)); if (xt_have_albums()) { echo $before_widget; echo '<div class="hd"><h4 class="xt-bd-l" ' . (!empty($title) ? '' : 'style="display:none;"') . '><span>' . $title . '</span></h4></div>'; echo '<div class="thumbnails thumbnails-span3 clearfix">'; while (xt_have_albums()) { xt_the_album(); get_the_album_template_small(0, '', false, $smallCount ? $smallCount : 3); } echo '<div class="clearfix"></div></div>'; echo $after_widget; } } }
<!-- //Item Img --> <div class="xt-share-main clearfix"> <!-- Item header --> <div class="xt-share-header clearfix"> </div> <!-- //Item header --> <!-- Item content --> <div class="xt-share-content"> <h2 class="xt-share-albums-title">TA的更多专辑 <a target="_blank" href="<?php xt_the_user_url(); ?> #album" class="xt-share-albums-more">查看全部</a></h2> <?php $isBig = xt_albumdisplay() == 'big' ? true : false; while (xt_have_albums()) { xt_the_album(); $_picurls = $isBig ? get_the_album_picurls_big() : get_the_album_picurls_small(); ?> <div class="xt-share-albums-list"> <h3 class="xt-share-album-title"> <span class="xt-r"><?php echo get_the_album_sharecount(); ?> 个分享</span><a href="<?php echo get_the_album_url(); ?> "><?php echo wp_trim_words(get_the_album_title(), 10); ?> </a> </h3>
function widget($args, $instance) { extract($args); $title = apply_filters('xt_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $dataType = $instance['dataType']; $user_id = intval($instance['user_id']); $count = intval($instance['count']); $cid = isset($instance['cid']) ? intval($instance['cid']) : 0; $ids = apply_filters('xt_filter_ids', $instance['ids']); if ($dataType == 'cid' && !empty($cid)) { query_albums(array('page' => 1, 'album_per_page' => $count, 'cid' => $cid)); } elseif ($dataType == 'ids' && !empty($ids)) { query_albums(array('no_found_rows' => 1, 'album__in' => explode(',', $ids))); } elseif ($dataType == 'user_id' && $user_id > 0) { query_albums(array('page' => 1, 'album_per_page' => $count, 'user_id' => $user_id)); } echo $before_widget; echo '<div class="hd"><h4 class="xt-bd-l" style="' . (empty($title) ? 'display:none' : '') . '"><span>' . $title . '</span></h4></div><div class="bd">'; echo '<div class="thumbnails thumbnails-span3 clearfix">'; if (xt_have_albums()) { while (xt_have_albums()) { xt_the_album(); get_the_album_template_small(0, '', true); } } echo '</div>'; echo '<div class="clearfix"></div></div>'; echo $after_widget; }
function get_the_album_container($_params = array(), $isCatalog = false, $isAjax = false, $isScroll = true) { if ($isAjax) { echo '<div id="X_Wall-Result" class="clearfix">'; } echo '<div id="X_Wall-Container" class="xt-wall-container row" data-scroll="' . ($isScroll ? 'true' : 'false') . '">'; $_user_id = 0; $_delClass = ''; $msg = 'album_not_found'; if (isset($_params['isFavorite']) && $_params['isFavorite']) { $_user_id = $_params['user_id']; $_delClass = 'xt-delete-favorite'; $msg = 'album_favorite_not_found'; } elseif (isset($_params['isShare']) && $_params['isShare']) { $msg = 'album_share_not_found'; } $_count = 0; $isBig = xt_albumdisplay() == 'big' ? true : false; while (xt_have_albums()) { xt_the_album(); if ($isBig) { get_the_album_template_big($_user_id, $_delClass); } else { get_the_album_template_small($_user_id, $_delClass); } $_count++; } if ($_count == 0) { echo xt_not_found($msg, 'xt-album-not-found'); } echo '</div>'; if ($isScroll) { echo "<div id=\"X_Page-Nav\" style=\"display: none; \"><a id=\"X_Page-Next-Link\" rel=\"nofollow\" href=\"" . admin_url('admin-ajax.php') . "?action=xt_ajax_search_albums&s_index=" . $_params['page'] . "&" . http_build_query($_params) . "\"></a></div>"; } echo '<div id="X_Pagination-Bottom" class="clearfix">'; echo '<div class="pagination xt-pagination-links">'; xt_albums_pagination_links(); echo '</div>'; echo '</div>'; if ($isAjax) { echo '</div>'; } }