本文整理汇总了PHP中update_post_thumbnail_cache函数 的典型用法代码示例。如果您正苦于以下问题:PHP update_post_thumbnail_cache函数的具体用法?PHP update_post_thumbnail_cache怎么用?PHP update_post_thumbnail_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_post_thumbnail_cache函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:vibjerg, 项目名称:zippo, 代码行数:33, 代码来源:head-slider-functions.php
示例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);
}
开发者ID:plis197715, 项目名称:wordpress-develop, 代码行数:8, 代码来源:thumbnails.php
示例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;
}
开发者ID:RDePoppe, 项目名称:luminaterealestate, 代码行数:56, 代码来源:portfolio.php
示例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);
}
开发者ID:hieu-pv, 项目名称:NFWP, 代码行数:49, 代码来源:HasAttachment.php
示例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);
}
开发者ID:alpineio, 项目名称:atlas, 代码行数:21, 代码来源:PhotoFieldType.php
示例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";
}
开发者ID:RDePoppe, 项目名称:luminaterealestate, 代码行数:48, 代码来源:team.php
示例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);
}
开发者ID:AppItNetwork, 项目名称:yii2-wordpress-themes, 代码行数:20, 代码来源:post-thumbnail-template.php
示例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;
}
开发者ID:RDePoppe, 项目名称:luminaterealestate, 代码行数:20, 代码来源:class-shortcode.php
示例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";
}
开发者ID:RDePoppe, 项目名称:luminaterealestate, 代码行数:38, 代码来源:testimonials-slider.php
示例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
开发者ID:justinwool, 项目名称:vortago, 代码行数:67, 代码来源:feature-slider.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);
}
开发者ID:10asfar, 项目名称:WordPress-the7-theme-demo-, 代码行数:33, 代码来源:admin-functions.php
示例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;
}
开发者ID:10asfar, 项目名称:WordPress-the7-theme-demo-, 代码行数:95, 代码来源:metabox-fields.php
示例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');
?>
开发者ID:justinwool, 项目名称:vortago, 代码行数:31, 代码来源:page_jw.php
示例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) {
?>
开发者ID:justinwool, 项目名称:vortago, 代码行数:67, 代码来源:scroller.php
示例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) {
?>
//.........这里部分代码省略.........
开发者ID:justinwool, 项目名称:vortago, 代码行数:101, 代码来源:postsImages-widget.php
示例16: presscore_get_blog_query
function presscore_get_blog_query()
{
$config = presscore_get_config();
$orderby = $config->get('orderby');
$query_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $config->get('order'), 'orderby' => 'name' == $orderby ? 'title' : $orderby);
$ppp = $config->get('posts_per_page');
if ($ppp) {
$query_args['posts_per_page'] = intval($ppp);
}
$display = $config->get('display');
if (!empty($display['terms_ids'])) {
$terms_ids = array_values($display['terms_ids']);
switch ($display['select']) {
case 'only':
$query_args['category__in'] = $terms_ids;
break;
case 'except':
$query_args['category__not_in'] = $terms_ids;
}
}
// get filter request
$request_display = $config->get('request_display');
if ($request_display) {
// get all dt_portfolio_category terms
$all_terms = get_categories(array('type' => 'post', 'hide_empty' => 1, 'hierarchical' => 0, 'taxonomy' => 'category', 'pad_counts' => false));
// populate $all_terms_array with terms names
$all_terms_array = array();
foreach ($all_terms as $term) {
$all_terms_array[] = $term->term_id;
}
// except for empty term that appers when all filter category selcted, see it's url
if (0 == current($request_display['terms_ids'])) {
$request_display['terms_ids'] = $all_terms_array;
}
// override base tax_query
$query_args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => array_values($request_display['terms_ids']), 'operator' => 'IN'));
if ('except' == $request_display['select']) {
$query_args['tax_query'][0]['operator'] = 'NOT IN';
}
}
$query = new WP_Query($query_args);
update_post_thumbnail_cache($query);
return $query;
}
开发者ID:RDePoppe, 项目名称:luminaterealestate, 代码行数:44, 代码来源:blog-helpers.php
示例17: mom_blog_sc
function mom_blog_sc($atts, $content)
{
extract(shortcode_atts(array('style' => '', 'display' => '', 'category' => '', 'tag' => '', 'specific' => '', 'orderby' => '', 'posts_per_page' => 9, 'offset' => '', 'nexcerpt' => '', 'pagination' => 'yes', 'class' => '', 'cols' => 2, 'post_type' => '', 'ad_id' => '', 'ad_count' => 3, 'ad_repeat' => ''), $atts));
$cols = 'grid-col-' . $cols;
static $id = 75;
$id++;
if ($category == 'Select a Category') {
$category = '';
}
if ($tag == 'Select a Tag') {
$tag = '';
}
if (get_query_var('paged')) {
$paged = get_query_var('paged');
} elseif (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
global $post;
$exclude_posts = array($post->ID);
//$output = get_transient('mom_blog_sc_'.$id.$style.$display.$category.$tag.$specific.$orderby.$offset.$nexcerpt.$posts_per_page.$pagination.$paged);
$output = false;
if ($orderby == 'rand') {
$output = false;
}
if ($output == false) {
ob_start();
?>
<?php
if ($style == 'grid') {
?>
<div class="site-content page-wrap category-view-blog">
<?php
if (mom_option('cat_swi')) {
?>
<div class="f-tabbed-head">
<ul class="f-tabbed-sort cat-sort">
<li class="grid active"><a href="#"><span class="brankic-icon-grid"></span><?php
_e(' Grid', 'framework');
?>
</a></li>
<li class="list"><a href="#"><span class="brankic-icon-list2"></span><?php
_e(' List', 'framework');
?>
</a></li>
</ul>
</div>
<?php
}
?>
<?php
$catswi = mom_option('cat_swi_def');
$swiclass = 'cat-grid ' . $cols;
if ($catswi == 'list') {
$swiclass = 'cat-list';
}
$srclass = '';
if (mom_option('cat_swi') != true) {
$srclass = ' no-head';
}
?>
<div class="cat-body<?php
echo $srclass;
?>
">
<ul class="nb1 <?php
echo $swiclass;
?>
clearfix">
<?php
} else {
?>
<div class="blog_posts">
<?php
}
?>
<?php
if ($display == 'category') {
$args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'cat' => $category, 'offset' => $offset, 'orderby' => $orderby, 'cache_results' => false);
} elseif ($display == 'tag') {
$args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'tag' => $tag, 'offset' => $offset, 'orderby' => $orderby, 'cache_results' => false);
} elseif ($display == 'specific') {
$args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'p' => $specific, 'orderby' => $orderby, 'cache_results' => false);
} else {
$args = array('post_type' => $post_type, 'post__not_in' => $exclude_posts, 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'paged' => $paged, 'offset' => $offset, 'orderby' => $orderby, 'cache_results' => false);
}
$post_count = 1;
$query = new WP_Query($args);
update_post_thumbnail_cache($query);
?>
<?php
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
?>
<?php
$grid_class = '';
//.........这里部分代码省略.........
开发者ID:justinwool, 项目名称:vortago, 代码行数:101, 代码来源:blog.php
GitbookIO/gitbook:
阅读:954| 2022-08-17
juleswhite/mobile-cloud-asgn1
阅读:1029| 2022-08-30
kyamagu/matlab-json: Use official API: https://mathworks.com/help/matlab/json-fo
阅读:923| 2022-08-17
书名:墙壁眼睛膝盖 作者:温柔一刀 类别:欲望丛林,饮食男女。 簡介:Wall(我)Eye(爱)Kn
阅读:655| 2022-11-06
sevenjay/cpp-markdown: Cpp-Markdown is a freely-available Markdown text-to-HTML
阅读:578| 2022-08-18
小程序为了用户体验,所有的request均为异步请求,不会阻塞程序运行百牛信息技术baini
阅读:523| 2022-07-18
如何实现小程序刮刮卡呢?思路是:先将中奖的图片或者文字位置和大小确定开始画canvas
阅读:561| 2022-07-18
Out-of-bounds Write in GitHub repository vim/vim prior to 9.0.
阅读:500| 2022-07-08
mathjax/MathJax-i18n: MathJax localization
阅读:387| 2022-08-16
众所周知,我们的身份证号码里面包含的信息有很多,如出生日期、性别和识别码等,如果
阅读:251| 2022-11-06
请发表评论