当前位置: 首页>>代码示例>>PHP>>正文


PHP hb_resize函数代码示例

本文整理汇总了PHP中hb_resize函数的典型用法代码示例。如果您正苦于以下问题:PHP hb_resize函数的具体用法?PHP hb_resize怎么用?PHP hb_resize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hb_resize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: widget

 function widget($args, $instance)
 {
     extract($args);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $number = $instance['number'];
     $column_class = 'columns-3';
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Display the widget title if one was input (before and after defined by themes). */
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     /* Display Dribbble */
     if (!$number) {
         $number = -1;
     }
     $unique_id = "unique_id_" . rand(1, 50000);
     if ($category != "") {
         $loop = new WP_Query(array('post_type' => __('portfolio', 'hbthemes'), 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => $number, 'tax_query' => array(array('taxonomy' => 'portfolio_categories', 'field' => 'id', 'terms' => $category))));
     } else {
         $loop = new WP_Query(array('post_type' => __('portfolio', 'hbthemes'), 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => $number));
     }
     if ($number == 1 || $number == -1) {
         $column_class = 'columns-1';
     }
     if ($number == 2) {
         $column_class = 'columns-2';
     }
     if ($number == 3 || $number == 6 || $number == 9 || $number == 15 || $number == 18) {
         $column_class = 'columns-3';
     }
     if ($number == 4 || $number == 8 || $number == 12 || $number == 16 || $number == 24) {
         $column_class = 'columns-4';
     }
     echo '<div class="hb-stream ' . $column_class . ' clearfix" id="' . $unique_id . '"><ul>';
     $counter = (int) $number;
     if ($loop->have_posts()) {
         while ($loop->have_posts()) {
             $loop->the_post();
             $thumb = get_post_thumbnail_id();
             $image = hb_resize($thumb, '', 250, 250, true);
             if ($thumb) {
                 $counter--;
                 if ($counter >= 0) {
                     echo '<li><a href="' . get_permalink() . '" title="' . get_the_title() . '" rel="tooltip">';
                     echo '<img src="' . $image['url'] . '" width="' . $image['width'] . '" height="' . $image['height'] . '" />';
                     echo '</a></li>';
                 }
             }
         }
     }
     wp_reset_query();
     echo '</ul></div>';
     /* After widget (defined by themes). */
     echo $after_widget;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:58,代码来源:widget-portfolio.php

示例2: get_post_thumbnail_id

			</script>
		</div>
		<?php 
        break;
    default:
        ?>
		<?php 
        // get featured image
        $thumb = get_post_thumbnail_id();
        $image_height = hb_options('hb_blog_image_height');
        $image_width = 1140;
        $full_image = wp_get_attachment_image_src($thumb, 'full', false);
        if (vp_metabox('layout_settings.hb_page_layout_sidebar')) {
            $image_width = 832;
        }
        $image = hb_resize($thumb, '', $image_width, $image_height, true);
        if ($image) {
            ?>
		<div class="featured-image">
			<a data-title="<?php 
            the_title();
            ?>
" href="<?php 
            echo $full_image[0];
            ?>
" rel="prettyPhoto">
				<img src="<?php 
            echo $image['url'];
            ?>
" alt="<?php 
            the_title();
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:single-featured-format.php

示例3: __

    } else {
        if (time() - 60 * 60 * 24 * $newness < $postdatestamp) {
            echo '<span class="wc-new-badge">' . __('New', 'hbthemes') . '</span>';
        }
    }
}
?>

	<?php 
if (has_post_thumbnail()) {
    $image_title = get_the_title();
    $image_link = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    $image_object = get_post_thumbnail_id();
    $attachment_count = count($product->get_gallery_attachment_ids());
    $image_object = get_post_thumbnail_id();
    $image_cropped = hb_resize($image_object, '', 547, 547, true);
    $image = $image_link;
    $image_print = '<img class="hb-woo-featured-image" src="' . $image_cropped['url'] . '" width="' . $image_cropped['width'] . '" height="' . $image_cropped['height'] . '">';
    if ($attachment_count > 0) {
        $gallery = '[product-gallery]';
    } else {
        $gallery = '';
    }
    echo apply_filters('woocommerce_single_product_image_html', sprintf('<a href="%s" itemprop="image" class="woocommerce-main-image zoom" data-title="%s" rel="prettyPhoto' . $gallery . '">%s</a>', $image_link[0], $image_title, $image_print), $post->ID);
} else {
    echo apply_filters('woocommerce_single_product_image_html', sprintf('<img src="%s" alt="Placeholder" />', wc_placeholder_img_src()), $post->ID);
}
?>

	<?php 
do_action('woocommerce_product_thumbnails');
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:product-image.php

示例4: _e

			<h4 class="hb-heading hb-center-heading alt-color-1"><span><?php 
    _e('Meet More Team Members', 'hbthemes');
    ?>
</span></h4>
		</div>
	</div>

	<!-- BEGIN .related-portfolio-items -->
	<div class="row related-members">
	<?php 
    while ($related_items->have_posts()) {
        $related_items->the_post();
        ?>
		<?php 
        $thumb = get_post_thumbnail_id();
        $image = hb_resize($thumb, '', 270, 270, true);
        if ($image) {
            ?>
			<div class="col-3">
				<div class="team-member-box">
			
					<div class="team-member-img">
						<a href="<?php 
            the_permalink();
            ?>
"><img src="<?php 
            echo $image['url'];
            ?>
" alt="<?php 
            the_title();
            ?>
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:team-related-items.php

示例5: do_action

 */
do_action('woocommerce_before_shop_loop_item_title');
if (get_the_post_thumbnail()) {
    $image_object = get_post_thumbnail_id();
    $image_title = esc_attr(get_the_title(get_post_thumbnail_id()));
    $image_link = wp_get_attachment_url(get_post_thumbnail_id());
    $image = hb_resize($image_object, '', 526, 700, true);
    echo '<div class="woo-category-wrap"><img src="' . $image["url"] . '" width="' . $image["width"] . '" height="' . $image["height"] . '"></div>';
} else {
    echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" width="526" height="700" />';
}
$product_gallery = get_post_meta($post->ID, '_product_image_gallery', true);
if (!empty($product_gallery)) {
    $gallery = explode(',', $product_gallery);
    $image_id = $gallery[0];
    $image_src_hover = hb_resize($image_id, '', 526, 700, true);
    echo '<img src="' . $image_src_hover['url'] . '" alt="' . get_the_title() . '" class="product-hover-image" title="' . get_the_title() . '">';
}
$postdate = get_the_time('Y-m-d');
// Post date
$postdatestamp = strtotime($postdate);
// Timestamped post date
$newness = 3;
// Newness in days
if ($product->sale_price) {
    // Sale will be added through action hook
} else {
    if (hb_is_out_of_stock()) {
        echo '<span class="out-of-stock-badge">' . __('Sold out', 'hbthemes') . '</span>';
    } else {
        if (time() - 60 * 60 * 24 * $newness < $postdatestamp) {
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:content-product.php

示例6: while

</h4>
	<?php 
    }
    ?>
					
	<div class="row">
	<?php 
    while ($related_posts->have_posts()) {
        $related_posts->the_post();
        ?>

		<!-- BEGIN .related-item -->
		<div class="col-4 related-item">
		<?php 
        $thumb = get_post_thumbnail_id();
        $image = hb_resize($thumb, '', 300, 200, true);
        if ($image) {
            ?>
				<div class="featured-image">
					<a href="<?php 
            the_permalink();
            ?>
">
						<img alt="<?php 
            the_title();
            ?>
" title="<?php 
            the_title();
            ?>
" src="<?php 
            echo $image['url'];
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:post-related-articles.php

示例7: widget

    function widget($args, $instance)
    {
        extract($args);
        global $wp_query;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        $order = $instance['order'];
        $orderby = $instance['orderby'];
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>

		<?php 
        if (!$number) {
            $number = -1;
        }
        $testimonials = new WP_Query(array('post_type' => 'hb_testimonials', 'posts_per_page' => $number, 'orderby' => $orderby, 'order' => $order));
        $rand_num = rand(1, 100000);
        if ($testimonials->have_posts()) {
            ?>
			<div id="hb-testimonial-<?php 
            echo $rand_num;
            ?>
" class="ts-1">
				<ul class="testimonial-slider">
				<?php 
            while ($testimonials->have_posts()) {
                $testimonials->the_post();
                ?>
					<li class="hb-testimonial-box">
						<div class="hb-testimonial">
							<?php 
                the_content();
                ?>
						</div>
						
						<?php 
                $author_image = vp_metabox('testimonial_type_settings.hb_testimonial_author_image');
                $author_name = vp_metabox('testimonial_type_settings.hb_testimonial_author');
                $author_desc = vp_metabox('testimonial_type_settings.hb_testimonial_description');
                $author_desc_link = vp_metabox('testimonial_type_settings.hb_testimonial_description_link');
                if ($author_image) {
                    $author_image = hb_resize(null, $author_image, 60, 60, true);
                    ?>
							<img src="<?php 
                    echo $author_image['url'];
                    ?>
" width="60" height="60" class="testimonial-author-img"/>
						<?php 
                }
                ?>

						<?php 
                if ($author_name || $author_desc) {
                    ?>
						<div class="testimonial-author">
							<?php 
                    if ($author_name) {
                        ?>
							<h5 class="testimonial-author-name">
							<?php 
                        echo $author_name;
                        ?>
							</h5>
							<?php 
                    }
                    ?>

							<?php 
                    if ($author_desc && $author_desc_link) {
                        ?>
								<a href="<?php 
                        echo $author_desc_link;
                        ?>
" class="testimonial-company"><?php 
                        echo $author_desc;
                        ?>
</a>
							<?php 
                    } else {
                        if ($author_desc) {
                            ?>
								<a class="testimonial-company"><?php 
                            echo $author_desc;
                            ?>
</a>
							<?php 
                        }
                    }
                    ?>
						</div>
						<?php 
                }
                ?>
					</li>
//.........这里部分代码省略.........
开发者ID:phupx,项目名称:genco,代码行数:101,代码来源:widget-testimonials.php

示例8: the_ID

<article id="post-<?php 
the_ID();
?>
" <?php 
if (has_post_thumbnail()) {
    post_class('image-post-type with-featured-image');
} else {
    post_class('image-post-type');
}
?>
 itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost">
	<?php 
// get featured image
$thumb = get_post_thumbnail_id();
if ($thumb) {
    $image = hb_resize($thumb, '', 900, 500, true);
    if ($image) {
        ?>
	
	<div class="featured-image">
		<a href="<?php 
        the_permalink();
        ?>
">
			<img src="<?php 
        echo $image['url'];
        ?>
" alt="<?php 
        the_title();
        ?>
" />
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:post-format-image.php

示例9: _e

			<h4 class="hb-heading hb-center-heading alt-color-1"><span><?php 
    _e('Related Projects', 'hbthemes');
    ?>
</span></h4>
		</div>
	</div>

	<!-- BEGIN .related-portfolio-items -->
	<div class="row related-portfolio-items columns-4">
	<?php 
    while ($related_items->have_posts()) {
        $related_items->the_post();
        ?>
		<?php 
        $thumb = get_post_thumbnail_id();
        $image = hb_resize($thumb, '', 289, 216, true);
        if ($image) {
            ?>
			<!-- BEGIN .portfolio-related-item -->
			<div class="portfolio-related-item">
				<div class="standard-gallery-item">
					<div class="hb-gal-standard-img-wrapper">
						<a href="<?php 
            the_permalink();
            ?>
">
							<img src="<?php 
            echo $image['url'];
            ?>
">
							<div class="item-overlay"></div>
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:portfolio-related-items.php

示例10: get_post_thumbnail_id

                         $icon_to_use = 'hb-moon-quotes-right';
                     } else {
                         if ($format == 'link') {
                             $icon_to_use = 'hb-moon-link-5';
                         }
                     }
                 }
             }
         }
     }
     $thumb = get_post_thumbnail_id();
     $full_thumb = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'original');
     echo '<article class="search-entry clearfix">';
     echo '<span class="search-result-counter ">' . $search_counter . '</span>';
     if ($thumb) {
         $image = hb_resize($thumb, '', 80, 80, true);
         echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="search-thumb"><img src="' . $image['url'] . '" alt="' . get_the_title() . '" /></a>';
     } else {
         echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="search-thumb"><i class="' . $icon_to_use . '"></i></a>';
     }
     $echo_title = get_the_title();
     if ($echo_title == "") {
         $echo_title = __('No Title', 'hbthemes');
     }
     echo '<h4 class="semi-bold"><a href="' . get_permalink() . '" title="' . $echo_title . '">' . $echo_title . '</a></h4>';
     echo '<div class="minor-meta">' . get_the_time('M j, Y') . '</div>';
     echo '<div class="excerpt-wrap">';
     the_excerpt();
     echo '</div>';
     echo '</article>';
 }
开发者ID:phupx,项目名称:genco,代码行数:31,代码来源:archive.php

示例11: hb_testimonial_box

function hb_testimonial_box($post_id)
{
    $testimonial_post = get_post($post_id);
    if ($testimonial_post) {
        setup_postdata($testimonial_post);
        ?>
	<div class="hb-testimonial">
		<?php 
        the_content();
        ?>
	</div>
						
	<?php 
        $author_image = vp_metabox('testimonial_type_settings.hb_testimonial_author_image');
        $author_name = vp_metabox('testimonial_type_settings.hb_testimonial_author');
        $author_desc = vp_metabox('testimonial_type_settings.hb_testimonial_description');
        $author_desc_link = vp_metabox('testimonial_type_settings.hb_testimonial_description_link');
        if ($author_image) {
            $author_image = hb_resize(null, $author_image, 60, 60, true);
            ?>
			<img src="<?php 
            echo $author_image['url'];
            ?>
" width="60" height="60" class="testimonial-author-img"/>
		<?php 
        }
        ?>

		<?php 
        if ($author_name || $author_desc) {
            ?>
			<div class="testimonial-author">
				<?php 
            if ($author_name) {
                ?>
					<h5 class="testimonial-author-name">
						<?php 
                echo $author_name;
                ?>
					</h5>
				<?php 
            }
            ?>

				<?php 
            if ($author_desc && $author_desc_link) {
                ?>
					<a href="<?php 
                echo $author_desc_link;
                ?>
" class="testimonial-company"><?php 
                echo $author_desc;
                ?>
</a>
				<?php 
            } else {
                if ($author_desc) {
                    ?>
					<a class="testimonial-company"><?php 
                    echo $author_desc;
                    ?>
</a>
				<?php 
                }
            }
            ?>
			</div>
		<?php 
        }
        wp_reset_postdata();
    }
}
开发者ID:phupx,项目名称:genco,代码行数:72,代码来源:testimonial-box.php

示例12: widget

    function widget($args, $instance)
    {
        extract($args);
        global $wp_query;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        $category = $instance['category'];
        $orderby = $instance['orderby'];
        $order = $instance['order'];
        $show_excerpt = !empty($instance['show_excerpt']) ? $instance['show_excerpt'] : false;
        $show_thumb = !empty($instance['show_thumb']) ? $instance['show_thumb'] : false;
        /* Before widget (defined by themes). */
        echo $before_widget;
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        if (!$number) {
            $number = -1;
        }
        $blog_posts = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number, 'category__in' => $category, 'orderby' => $orderby, 'order' => $order, 'ignore_sticky_posts' => true));
        if ($blog_posts->have_posts()) {
            ?>
			<ul>
			<?php 
            while ($blog_posts->have_posts()) {
                $blog_posts->the_post();
                $excerpt = wp_trim_words(get_the_excerpt(), 10, '...<br/><a class="hb-focus-color" href="' . get_permalink() . '">' . __("Read More", "hbthemes") . '</a>');
                $thumb = get_post_thumbnail_id();
                $full_thumb = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'original');
                $image_thumb = '';
                $simple_class = '';
                if (!$thumb && !$show_thumb || !$show_excerpt && !$show_thumb) {
                    $simple_class = ' simple';
                }
                if ($thumb && $show_thumb) {
                    $image = hb_resize($thumb, '', 80, 80, true);
                    $image_thumb = '<div class="hb-spl-thumb"><a href="' . get_the_permalink() . '"><img src="' . $image['url'] . '" alt="' . get_the_title() . '" /></a></div>';
                }
                ?>


					<li class="clearfix<?php 
                echo $simple_class;
                ?>
">
						
						<?php 
                echo $image_thumb;
                ?>
						<div class="hb-spl-inner">
							<a href="<?php 
                echo get_the_permalink();
                ?>
"><?php 
                echo get_the_title();
                ?>
</a>
							<?php 
                if ($show_excerpt) {
                    ?>
								<span class="hb-spl-excerpt"><?php 
                    echo $excerpt;
                    ?>
</span>
							<?php 
                }
                ?>
						</div>
					</li>
			<?php 
            }
            ?>
			</ul>
		<?php 
        }
        echo $after_widget;
    }
开发者ID:phupx,项目名称:genco,代码行数:79,代码来源:widget-latest-posts-simple.php

示例13: do_action

	<?php 
do_action('woocommerce_before_subcategory', $category);
?>

	<a href="<?php 
echo get_term_link($category->slug, 'product_cat');
?>
">

		<?php 
$small_thumbnail_size = apply_filters('single_product_small_thumbnail_size', 'shop_catalog');
$dimensions = wc_get_image_size($small_thumbnail_size);
$thumbnail_id = get_woocommerce_term_meta($category->term_id, 'thumbnail_id', true);
if ($thumbnail_id) {
    $image = hb_resize($thumbnail_id, '', 526, 700, true);
} else {
    $image = wc_placeholder_img_src();
}
if ($image) {
    $image = str_replace(' ', '%20', $image);
    echo '<a href="' . get_term_link($category->slug, 'product_cat') . '" class="woo-category-wrap"><img src="' . esc_url($image["url"]) . '" alt="' . esc_attr($category->name) . '" width="' . esc_attr($image['width']) . '" height="' . esc_attr($image['height']) . '" />';
}
?>

		<div class="woo-cat-details">
		<h6 class="special">
			<?php 
echo $category->name;
?>
		</h6>
开发者ID:phupx,项目名称:genco,代码行数:30,代码来源:content-product_cat.php

示例14: hb_team_member_box

function hb_team_member_box($post_id, $style = "", $excerpt_length = 20)
{
    $testimonial_post = get_post($post_id);
    if ($testimonial_post) {
        setup_postdata($testimonial_post);
        $thumb = get_post_thumbnail_id();
        if ($style != "") {
            $style = " tmb-2";
        }
        ?>

	<!-- BEGIN .team-member-box -->
	<div class="team-member-box<?php 
        echo $style;
        ?>
">
								
		<div class="team-member-img">
			<?php 
        if ($thumb) {
            $image = hb_resize($thumb, '', 350, 350, true);
            if ($image) {
                ?>
				<img src="<?php 
                echo $image['url'];
                ?>
" alt="<?php 
                the_title();
                ?>
"/>
			<?php 
            }
            ?>
				<ul class="social-icons dark">
			<?php 
            $social_links = array("envelop" => "Mail", "dribbble" => "Dribbble", "facebook" => "Facebook", "flickr" => "Flickr", "forrst" => "Forrst", "google-plus" => "Google Plus", "html5" => "HTML 5", "cloud" => "iCloud", "lastfm" => "LastFM", "linkedin" => "LinkedIn", "paypal" => "PayPal", "pinterest" => "Pinterest", "reddit" => "Reddit", "feed2" => "RSS", "skype" => "Skype", "stumbleupon" => "StumbleUpon", "tumblr" => "Tumblr", "twitter" => "Twitter", "vimeo" => "Vimeo", "wordpress" => "WordPress", "yahoo" => "Yahoo", "youtube" => "YouTube", "github" => "Github", "yelp" => "Yelp", "mail" => "Mail", "instagram" => "Instagram", "foursquare" => "Foursquare", "xing" => "Xing");
            foreach ($social_links as $soc_id => $soc_name) {
                if (vp_metabox('team_member_settings.hb_employee_social_' . $soc_id)) {
                    ?>
						<li class="<?php 
                    echo $soc_id;
                    ?>
"><a href="<?php 
                    echo vp_metabox('team_member_settings.hb_employee_social_' . $soc_id);
                    ?>
" target="_blank"><i class="hb-moon-<?php 
                    echo $soc_id;
                    ?>
"></i><i class="hb-moon-<?php 
                    echo $soc_id;
                    ?>
"></i></a></li>
						<?php 
                }
            }
            ?>
				</ul>
			<?php 
        }
        ?>

		</div>
									
		<!-- START .team-member-description -->
		<div class="team-member-description">
										
			<!-- START .team-header-info -->
			<div class="team-header-info clearfix">
											
				<!-- START .team-header-name -->
				<div class="team-name">
					<h4 class="team-member-name"><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a></h4>
					<?php 
        if (vp_metabox('team_member_settings.hb_employee_position')) {
            ?>
					<p class="team-position"><?php 
            echo vp_metabox('team_member_settings.hb_employee_position');
            ?>
</p>
					<?php 
        }
        ?>
				</div>
				<!-- END .team-name -->
											
											
			</div>
			<!-- END .team-header-info -->

			<div class="spacer" style="height:10px;"></div>

			<!-- START .team-member-content -->
			<div class="team-member-content">
				<?php 
//.........这里部分代码省略.........
开发者ID:phupx,项目名称:genco,代码行数:101,代码来源:team-member-box.php

示例15: widget

 function widget($args, $instance)
 {
     extract($args);
     global $wp_query;
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $number = $instance['number'];
     $category = $instance['category'];
     $column_class = 'columns-3';
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Display the widget title if one was input (before and after defined by themes). */
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     if (!$number) {
         $number = -1;
     }
     $unique_id = "unique_id_" . rand(1, 50000);
     if ($category) {
         $portfolio_items = new WP_Query(array('post_type' => 'portfolio', 'meta_key' => '_likes', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'posts_per_page' => $number, 'tax_query' => array(array('taxonomy' => 'portfolio_categories', 'field' => 'id', 'terms' => $category))));
     } else {
         $portfolio_items = new WP_Query(array('post_type' => 'portfolio', 'meta_key' => '_likes', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'posts_per_page' => $number));
     }
     if (!$number) {
         $number = 1;
     }
     if ($number == 1) {
         $column_class = 'columns-1';
     }
     if ($number == 2) {
         $column_class = 'columns-2';
     }
     if ($number == 3 || $number == 6 || $number == 9 || $number == 15 || $number == 18) {
         $column_class = 'columns-3';
     }
     if ($number == 4 || $number == 8 || $number == 12 || $number == 16 || $number == 24) {
         $column_class = 'columns-4';
     }
     echo '<div class="hb-stream ' . $column_class . ' clearfix" id="' . $unique_id . '"><ul>';
     $counter = (int) $number;
     if ($portfolio_items->have_posts()) {
         while ($portfolio_items->have_posts()) {
             $portfolio_items->the_post();
             $perma = get_the_permalink();
             $custom_url = vp_metabox('portfolio_settings.hb_portfolio_custom_url');
             if ($custom_url) {
                 $perma = $custom_url;
             }
             $thumb = get_post_thumbnail_id();
             $image = hb_resize($thumb, '', 250, 250, true);
             $likes = hb_like_this(get_the_ID());
             if ($thumb) {
                 $counter--;
                 if ($counter >= 0) {
                     echo '<li><a href="' . $perma . '" title="' . get_the_title() . '" rel="tooltip">';
                     echo '<img src="' . $image['url'] . '" />';
                     echo '<span class="widget-like-count"><i class="hb-moon-heart"></i>' . number_format($likes) . '</span>';
                     echo '</a></li>';
                 }
             }
         }
     }
     wp_reset_query();
     echo '</ul></div>';
     echo $after_widget;
 }
开发者ID:phupx,项目名称:genco,代码行数:67,代码来源:widget-most-liked-portfolio.php


注:本文中的hb_resize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。