本文整理汇总了PHP中update_post_thumbnail_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP update_post_thumbnail_cache函数的具体用法?PHP update_post_thumbnail_cache怎么用?PHP update_post_thumbnail_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_post_thumbnail_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zippo_thumbnail_url
function zippo_thumbnail_url($post_id = null, $size = 'post-thumbnail', $attr = '')
{
$url = array();
$post_id = null === $post_id ? get_the_ID() : $post_id;
$post_thumbnail_id = get_post_thumbnail_id($post_id);
/**
* Filter the post thumbnail size.
*
* @since 2.9.0
*
* @param string $size The post thumbnail size.
*/
$size = apply_filters('post_thumbnail_size', $size);
if ($post_thumbnail_id) {
/**
* Fires before fetching the post thumbnail HTML.
*
* Provides "just in time" filtering of all filters in wp_get_attachment_image().
*
* @since 2.9.0
*
* @param string $post_id The post ID.
* @param string $post_thumbnail_id The post thumbnail ID.
* @param string $size The post thumbnail size.
*/
do_action('begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size);
if (in_the_loop()) {
update_post_thumbnail_cache();
}
$url = wp_get_attachment_image_src($post_thumbnail_id, $size, false, $attr);
}
return reset($url);
}
示例2: test_update_post_thumbnail_cache
function test_update_post_thumbnail_cache()
{
set_post_thumbnail($this->post, $this->attachment_id);
$WP_Query = new WP_Query(array('post_type' => 'any', 'post__in' => array($this->post->ID), 'orderby' => 'post__in'));
$this->assertFalse($WP_Query->thumbnails_cached);
update_post_thumbnail_cache($WP_Query);
$this->assertTrue($WP_Query->thumbnails_cached);
}
示例3: widget
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, self::$widget_defaults);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_portfolio', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'term_id', 'terms' => $instance['cats'])));
switch ($instance['select']) {
case 'only':
$args['tax_query'][0]['operator'] = 'IN';
break;
case 'except':
$args['tax_query'][0]['operator'] = 'NOT IN';
break;
default:
unset($args['tax_query']);
}
$p_query = new WP_Query($args);
// for usage as shortcode
if (!isset($img_size)) {
$img_size = array($instance['max_width'], $instance['max_width']);
}
if (!isset($img_size_origin)) {
$img_size_origin = $img_size;
} else {
$p = $img_size[1] / $img_size[0];
$img_size_origin[1] = round($img_size_origin[0] * $p);
}
echo $before_widget;
// title
if ($title) {
echo $before_title . $title . $after_title;
}
if ($p_query->have_posts()) {
update_post_thumbnail_cache($p_query);
echo '<div class="instagram-photos" data-image-max-width="' . absint($instance['max_width']) . '">';
while ($p_query->have_posts()) {
$p_query->the_post();
$thumb_id = get_post_thumbnail_id(get_the_ID());
if (!has_post_thumbnail(get_the_ID())) {
$args = array('posts_per_page' => 1, 'no_found_rows' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => 'inherit');
$images = new WP_Query($args);
if ($images->have_posts()) {
$thumb_id = $images->posts[0]->ID;
}
}
$thumb_meta = wp_get_attachment_image_src($thumb_id, 'full');
dt_get_thumb_img(array('img_meta' => $thumb_meta ? $thumb_meta : null, 'img_id' => $thumb_id, 'use_noimage' => true, 'class' => 'post-rollover', 'title' => get_the_title(), 'href' => get_permalink(), 'options' => array('w' => $img_size_origin[0], 'h' => $img_size_origin[1]), 'wrap' => "\n" . '<a %HREF% %TITLE% %CLASS% %CUSTOM%><img %IMG_CLASS% %SRC% ' . image_hwstring($img_size[0], $img_size[1]) . ' %ALT% /></a>' . "\n"));
}
// while have posts
wp_reset_postdata();
echo '</div>';
}
// if have posts
echo $after_widget;
}
示例4: renderThumbnail
public function renderThumbnail($post, $post_thumbnail_id, $size, $attr)
{
$size = apply_filters('post_thumbnail_size', $size);
if ($post_thumbnail_id) {
/**
* Fires before fetching the post thumbnail HTML.
*
* Provides "just in time" filtering of all filters in wp_get_attachment_image().
*
* @since 2.9.0
*
* @param int $post_id The post ID.
* @param string $post_thumbnail_id The post thumbnail ID.
* @param string|array $size The post thumbnail size. Image size or array of width
* and height values (in that order). Default 'post-thumbnail'.
*/
do_action('begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size);
if (in_the_loop()) {
update_post_thumbnail_cache();
}
$html = wp_get_attachment_image($post_thumbnail_id, $size, false, $attr);
/**
* Fires after fetching the post thumbnail HTML.
*
* @since 2.9.0
*
* @param int $post_id The post ID.
* @param string $post_thumbnail_id The post thumbnail ID.
* @param string|array $size The post thumbnail size. Image size or array of width
* and height values (in that order). Default 'post-thumbnail'.
*/
do_action('end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size);
} else {
$html = '';
}
/**
* Filters the post thumbnail HTML.
*
* @since 2.9.0
*
* @param string $html The post thumbnail HTML.
* @param int $post_id The post ID.
* @param string $post_thumbnail_id The post thumbnail ID.
* @param string|array $size The post thumbnail size. Image size or array of width and height
* values (in that order). Default 'post-thumbnail'.
* @param string $attr Query string of attributes.
*/
return apply_filters('post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr);
}
示例5: getHTML
/**
* @param string|array $size
* @param string|array $attr
*
* @return string
*/
public function getHTML($size = 'thumbnail', $attr = '')
{
$size = apply_filters('post_thumbnail_size', $size);
if ($this->id) {
do_action('begin_fetch_post_thumbnail_html', $this->parent->id, $this->id, $size);
if (in_the_loop()) {
update_post_thumbnail_cache();
}
$html = wp_get_attachment_image($this->id, $size, false, $attr);
do_action('end_fetch_post_thumbnail_html', $this->parent->id, $this->id, $size);
} else {
$html = '';
}
return apply_filters('post_thumbnail_html', $html, $this->parent->id, $this->id, $size, $attr);
}
示例6: widget
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, self::$widget_defaults);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_team', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_team_category', 'field' => 'term_id', 'terms' => $instance['cats'])));
switch ($instance['select']) {
case 'only':
$args['tax_query'][0]['operator'] = 'IN';
break;
case 'except':
$args['tax_query'][0]['operator'] = 'NOT IN';
break;
default:
unset($args['tax_query']);
}
$p_query = new WP_Query($args);
$autoslide = absint($instance['autoslide']);
echo $before_widget . "\n";
// title
if ($title) {
echo $before_title . $title . $after_title . "\n";
}
if ($p_query->have_posts()) {
update_post_thumbnail_cache($p_query);
echo '<ul class="team-items slider-content round-images bg-under-post rsContW"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>', "\n";
// get config instance
$config = Presscore_Config::get_instance();
// backup and reset config
$config_backup = $config->get();
$this->setup_config($instance);
while ($p_query->have_posts()) {
$p_query->the_post();
presscore_populate_team_config();
echo '<li>';
$this->render_teammate($instance);
echo '</li>';
}
// while have posts
wp_reset_postdata();
// restore config
$config->reset($config_backup);
echo '</ul>', "\n";
}
// if have posts
echo $after_widget . "\n";
}
示例7: get_the_post_thumbnail
function get_the_post_thumbnail($post = null, $size = 'post-thumbnail', $attr = '')
{
$post = get_post($post);
if (!$post) {
return '';
}
$post_thumbnail_id = get_post_thumbnail_id($post);
$size = apply_filters('post_thumbnail_size', $size);
if ($post_thumbnail_id) {
do_action('begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size);
if (in_the_loop()) {
update_post_thumbnail_cache();
}
$html = wp_get_attachment_image($post_thumbnail_id, $size, false, $attr);
do_action('end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size);
} else {
$html = '';
}
return apply_filters('post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr);
}
示例8: get_posts_by_terms
public function get_posts_by_terms($instance = array())
{
if (empty($this->post_type) || empty($this->taxonomy)) {
return false;
}
$args = array('posts_per_page' => isset($instance['number']) ? $instance['number'] : -1, 'post_type' => $this->post_type, 'post_status' => 'publish', 'orderby' => isset($instance['orderby']) ? $instance['orderby'] : 'date', 'order' => isset($instance['order']) ? $instance['order'] : 'DESC', 'tax_query' => array(array('taxonomy' => $this->taxonomy, 'field' => 'slug', 'terms' => $instance['category'])));
switch ($instance['select']) {
case 'only':
$args['tax_query'][0]['operator'] = 'IN';
break;
case 'except':
$args['tax_query'][0]['operator'] = 'NOT IN';
break;
default:
unset($args['tax_query']);
}
$query = new WP_Query($args);
update_post_thumbnail_cache($query);
return $query;
}
示例9: widget
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, self::$widget_defaults);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_testimonials', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_testimonials_category', 'field' => 'term_id', 'terms' => $instance['cats'])));
switch ($instance['select']) {
case 'only':
$args['tax_query'][0]['operator'] = 'IN';
break;
case 'except':
$args['tax_query'][0]['operator'] = 'NOT IN';
break;
default:
unset($args['tax_query']);
}
$p_query = new WP_Query($args);
$autoslide = absint($instance['autoslide']);
echo $before_widget . "\n";
// title
if ($title) {
echo $before_title . $title . $after_title . "\n";
}
if ($p_query->have_posts()) {
update_post_thumbnail_cache($p_query);
echo '<ul class="testimonials slider-content rsContW"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>', "\n";
while ($p_query->have_posts()) {
$p_query->the_post();
echo '<li>' . Presscore_Inc_Testimonials_Post_Type::render_testimonial() . '</li>';
}
// while have posts
wp_reset_postdata();
echo '</ul>', "\n";
}
// if have posts
echo $after_widget . "\n";
}
示例10: mom_feature_slider
//.........这里部分代码省略.........
}
echo wp_html_excerpt(strip_shortcodes($excerpt), $exc);
?>
...
</p>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php
}
?>
<?php
}
} else {
}
wp_reset_postdata();
?>
<?php
if ($display == 'cat') {
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'cat' => $cats, 'posts_per_page' => 3, 'offset' => 2, 'orderby' => $orderby, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
} elseif ($display == 'tag') {
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'tag' => $tag, 'posts_per_page' => 3, 'offset' => 2, 'orderby' => $orderby, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
} elseif ($display == 'specific') {
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'post__in' => $specific, 'posts_per_page' => 3, 'offset' => 2, 'orderby' => $orderby, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
} else {
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 3, 'offset' => 2, 'orderby' => $orderby, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
}
update_post_thumbnail_cache($query);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
if ($unique_posts) {
$do_unique_posts[] = get_the_ID();
}
?>
<?php
if (mom_post_image() != false) {
?>
<div class="def-slider-item small-slider2" itemscope="" itemtype="http://schema.org/Article">
<a itemprop="url" href="<?php
the_permalink();
?>
"><?php
mom_post_image_full('catslider-thumb');
?>
</a>
<?php
if ($cap != 'no') {
?>
<div class="def-slider-cap">
<div class="def-slider-title">
<h2 itemprop="name"><a itemprop="url" href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
</div>
<?php
示例11: dt_get_admin_thumbnail
/**
* This function return array with thumbnail image meta for items list in admin are.
* If fitured image not set it gets last image by menu order.
* If there are no images and $noimage not empty it returns $noimage in other way it returns false
*
* @param integer $post_id
* @param integer $max_w
* @param integer $max_h
* @param string $noimage
*/
function dt_get_admin_thumbnail($post_id, $max_w = 100, $max_h = 100, $noimage = '')
{
$thumb = array();
update_post_thumbnail_cache();
if (has_post_thumbnail($post_id)) {
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'thumbnail');
}
$thumb = apply_filters('presscore_admin_get_post_thumbnail', $thumb, get_post_type($post_id), $post_id);
if (empty($thumb)) {
if (!$noimage) {
return false;
}
$thumb = $noimage;
$w = $max_w;
$h = $max_h;
} else {
$sizes = wp_constrain_dimensions($thumb[1], $thumb[2], $max_w, $max_h);
$w = $sizes[0];
$h = $sizes[1];
$thumb = $thumb[0];
}
return array(esc_url($thumb), $w, $h);
}
示例12: get_posts_tab
/**
* Get posts list.
*/
static function get_posts_tab()
{
if (!self::get_posts_query()->have_posts()) {
return '';
}
global $post, $wpdb;
$imgs_text = array(_x('no pictures', 'backend', 'the7mk2'), _x('1 picture', 'backend', 'the7mk2'), _x('% pictures', 'backend', 'the7mk2'));
$html = '';
$html .= '<div class="dt_tab-items hide-if-js">';
update_post_thumbnail_cache(self::get_posts_query());
foreach (self::get_posts_query()->posts as $_post) {
$attachments = get_post_meta($_post->ID, '_dt_album_media_items', true);
// count post images
$imgs_count = count($attachments);
// prepare title info
if (0 == $imgs_count) {
$title_info = $imgs_text[0];
} elseif (1 == $imgs_count) {
$title_info = $imgs_text[1];
} else {
$title_info = str_replace('%', $imgs_count, $imgs_text[2]);
}
// post terms
$terms = get_the_terms($_post->ID, self::$field['taxonomy']);
if (!is_wp_error($terms) && $terms) {
$term_links = array();
foreach ($terms as $term) {
$link = get_admin_url() . 'edit-tags.php';
$link = add_query_arg(array('action' => 'edit', 'post_type' => self::$field['post_type'], 'taxonomy' => self::$field['taxonomy'], 'tag_ID' => $term->term_id), $link);
$term_links[] = '<a href="' . esc_url($link) . '" rel="tag" target="_blank">' . $term->name . '</a>';
}
if (empty($term_links)) {
$term_links[] = 'none';
}
$terms_list = '<p><strong>' . _x('Categories: ', 'backend', 'the7mk2') . '</strong>' . implode(', ', $term_links) . '</p>';
} else {
$terms_list = '<p></p>';
}
// item start
$item_str = '<div class="dt_list-item"><div class="dt_item-holder">';
// item checkbox
$item_str .= sprintf('<label class="dt_checkbox"><input type="checkbox" name="%s" value="%s" %s /></label>', self::$field['field_name'] . '[posts_ids][' . $_post->ID . ']', $_post->ID, checked(in_array($_post->ID, (array) self::$meta['posts_ids']), true, false));
// get thumbnail or first post image
$img = '';
if (has_post_thumbnail($_post->ID)) {
$img = wp_get_attachment_image_src(get_post_thumbnail_id($_post->ID), 'thumbnail');
} else {
if ($attachments && is_array($attachments)) {
$img = wp_get_attachment_image_src(current($attachments), 'thumbnail');
}
}
// if no image
if (!$img) {
$img = array(get_template_directory_uri() . '/images/no-avatar.gif');
}
// image style and dimensions
$cover_style = 'dt_album-cover';
$w = $h = 88;
if ('dt_slider' == $_post->post_type) {
$cover_style = 'dt_slider-cover';
$w = 98;
$h = 68;
}
// image block
$item_str .= sprintf('<div class="dt_item-cover %s"><div><img src="%s" heught="%d" width="%d" /></div></div>', $cover_style, $img[0], $h, $w);
// description start
$item_str .= '<div class="dt_item-desc">';
// title
$item_str .= '<strong><a href="' . esc_url(get_admin_url() . 'post.php?post=' . $_post->ID . '&action=edit') . '" target="_blank">' . get_the_title($_post->ID) . '</a> (' . $title_info . ')</strong>';
// terms list
$item_str .= $terms_list;
// date
$date_format = get_option('date_format');
$item_str .= sprintf('<strong>%1$s</strong><abbr title="%2$s">%2$s</abbr>', _x('Date: ', 'backend', 'the7mk2'), apply_filters('get_the_date', mysql2date($date_format, $_post->post_date), $date_format));
// actions start
$item_str .= '<div class="row-actions">';
// edit
$item_str .= sprintf('<span class="edit"><a title="%s" href="%s" target="_blank">%s</a></span>', _x('Edit this item', 'backend', 'the7mk2'), esc_url(get_admin_url() . 'post.php?post=' . $_post->ID . '&action=edit'), _x('Edit', 'backend', 'the7mk2'));
// move to trash
if (current_user_can('edit_post', $_post->ID)) {
$item_str .= sprintf(' | <span class="trash"><a title="%s" href="%s">%s</a></span>', _x('Move this item to the Trash', 'backend', 'the7mk2'), wp_nonce_url(site_url() . "/wp-admin/post.php?action=trash&post=" . $_post->ID, 'trash-' . $_post->post_type . '_' . $_post->ID), _x('Trash', 'backend', 'the7mk2'));
}
// ections end
$item_str .= '</div>';
// description end
$item_str .= '</div>';
$item_str .= '</div></div>';
$html .= $item_str;
}
$html .= '</div>';
return $html;
}
示例13: get_the_category
?>
</h2>
</header>
<ul class="mom-related-posts clearfix">
<?php
global $post;
$cats = get_the_category($post->ID);
if ($cats) {
$cat_ids = array();
foreach ($cats as $individual_cat) {
$cat_ids[] = $individual_cat->cat_ID;
}
$args = array('category__in' => $cat_ids, 'post__not_in' => array($post->ID), 'showposts' => mom_option('related_count'), 'ignore_sticky_posts' => 1, 'no_found_rows' => true, 'cache_results' => false);
$query = new WP_Query($args);
update_post_thumbnail_cache($query);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
?>
<li itemscope="" itemtype="http://schema.org/Article">
<?php
if (mom_post_image() != false) {
?>
<figure class="post-thumbnail"><a href="<?php
the_permalink();
?>
">
<?php
mom_post_image_full('related-thumb');
?>
示例14: mom_scrollers
//.........这里部分代码省略.........
<span class="mom-sub-title"><?php
echo $sub_title;
?>
</span><?php
}
?>
</header>
<div class="scroller">
<div class="scroller-wrap scroller-wrap-1" data-sc-auto="<?php
echo $autoplay;
?>
" data-sc-autotime="<?php
echo $auto_play;
?>
" data-sc-speed="<?php
echo $speed;
?>
" data-sc-rtl="<?php
echo $rtl;
?>
" data-items="<?php
echo $items;
?>
">
<?php
if ($display == 'cats') {
$squery = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'cat' => $cats, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
} elseif ($display == 'tags') {
$squery = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'tag' => $tags, 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
} else {
$squery = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $number_of_posts, 'orderby' => $orderby, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
}
update_post_thumbnail_cache($squery);
if ($squery->have_posts()) {
while ($squery->have_posts()) {
$squery->the_post();
if ($unique_posts) {
$do_unique_posts[] = get_the_ID();
}
$post_url = get_post_meta(get_the_ID(), 'mom_post_custom_link', true);
if ($post_url == '') {
$post_url = get_permalink();
}
?>
<?php
if (mom_post_image() != false) {
?>
<div class="scroller-item" itemscope="" itemtype="http://schema.org/Article">
<a itemprop="url" href="<?php
echo $post_url;
?>
">
<figure class="post-thumbnail">
<?php
mom_post_image_full('scroller-thumb');
?>
</figure>
<h2 itemprop="name"><?php
the_title();
?>
</h2>
</a>
<?php
if ($post_head != 0) {
?>
示例15: widget
function widget($args, $instance)
{
extract($args);
/* User-selected settings. */
$title = apply_filters('widget_title', $instance['title']);
$orderby = $instance['orderby'];
$count = $instance['count'];
$display = isset($instance['display']) ? $instance['display'] : array();
$cats = isset($instance['cats']) ? $instance['cats'] : array();
$output = get_transient($this->id);
if ($orderby == 'Random') {
$output = false;
}
if ($output == false) {
ob_start();
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
global $unique_posts;
global $do_unique_posts;
?>
<div class="news-pics-widget">
<ul class="npwidget clearfix">
<?php
if ($orderby == 'Popular') {
?>
<?php
if ($display == 'cats') {
$catsi = implode(',', $cats);
?>
<?php
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'cat' => $catsi, 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'orderby' => 'comment_count', 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
?>
<?php
} else {
?>
<?php
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'orderby' => 'comment_count', 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
?>
<?php
}
?>
<?php
} elseif ($orderby == 'Random') {
?>
<?php
if ($display == 'cats') {
$catsi = implode(',', $cats);
?>
<?php
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'cat' => $catsi, 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'orderby' => 'rand', 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
?>
<?php
} else {
?>
<?php
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'orderby' => 'comment_count', 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
?>
<?php
}
?>
<?php
} elseif ($orderby == 'Recent') {
?>
<?php
if ($display == 'cats') {
$catsi = implode(',', $cats);
?>
<?php
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'cat' => $catsi, 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
?>
<?php
} else {
?>
<?php
$query = new WP_Query(array('post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $count, 'no_found_rows' => true, 'cache_results' => false, 'post__not_in' => $do_unique_posts));
?>
<?php
}
?>
<?php
}
?>
<?php
update_post_thumbnail_cache($query);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
if ($unique_posts) {
$do_unique_posts[] = get_the_ID();
}
?>
<?php
if (mom_post_image() != false) {
?>
//.........这里部分代码省略.........